Skip to content

Commit 9dccd01

Browse files
committed
fix(plugin-jsx): interop default
1 parent baf3792 commit 9dccd01

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "vue-jsx-monorepo",
33
"private": true,
44
"packageManager": "[email protected]",
5+
"type": "module",
56
"scripts": {
67
"build": "pnpm run -r build",
78
"test": "vitest",

packages/babel-plugin-jsx/src/index.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as t from '@babel/types';
22
import type * as BabelCore from '@babel/core';
3-
import template from '@babel/template';
3+
import _template from '@babel/template';
44
// @ts-expect-error
5-
import syntaxJsx from '@babel/plugin-syntax-jsx';
5+
import _syntaxJsx from '@babel/plugin-syntax-jsx';
66
// @ts-expect-error
77
import { addNamed, addNamespace, isModule } from '@babel/helper-module-imports';
88
import { type NodePath } from '@babel/traverse';
@@ -31,9 +31,17 @@ const hasJSX = (parentPath: NodePath<t.Program>) => {
3131

3232
const JSX_ANNOTATION_REGEX = /\*?\s*@jsx\s+([^\s]+)/;
3333

34+
/* #__NO_SIDE_EFFECTS__ */
35+
function interopDefault(m: any) {
36+
return m.default || m;
37+
}
38+
39+
const syntaxJsx = /*#__PURE__*/ interopDefault(_syntaxJsx);
40+
const template = /*#__PURE__*/ interopDefault(_template);
41+
3442
export default ({ types }: typeof BabelCore): BabelCore.PluginObj<State> => ({
3543
name: 'babel-plugin-jsx',
36-
inherits: syntaxJsx,
44+
inherits: /*#__PURE__*/ interopDefault(syntaxJsx),
3745
visitor: {
3846
...transformVueJSX,
3947
...sugarFragment,

0 commit comments

Comments
 (0)