Skip to content

Commit e9c7e2c

Browse files
committed
refactor: disable resolveType by default
1 parent 830fa7d commit e9c7e2c

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default declare<VueJSXPluginOptions, BabelCore.PluginObj<State>>(
4444
(api, opt, dirname) => {
4545
const { types } = api;
4646
let resolveType: BabelCore.PluginObj<BabelCore.PluginPass> | undefined;
47-
if (opt.resolveType !== false) {
47+
if (opt.resolveType) {
4848
if (typeof opt.resolveType === 'boolean') opt.resolveType = {};
4949
resolveType = ResolveType(api, opt.resolveType, dirname);
5050
}

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ export interface VueJSXPluginOptions {
2525
/** Replace the function used when compiling JSX expressions */
2626
pragma?: string;
2727
/**
28-
* enabled by default
28+
* (**Experimental**) Infer component metadata from types (e.g. `props`, `emits`, `name`)
29+
* @default false
2930
*/
3031
resolveType?: Options | boolean;
3132
}

packages/babel-plugin-jsx/test/__snapshots__/snapshot.test.ts.snap

-2
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,6 @@ const A = defineComponent({
188188
}) {
189189
return () => _createVNode("span", null, [slots.default()]);
190190
}
191-
}, {
192-
name: "A"
193191
});
194192
const _a2 = 2;
195193
a = _a2;

packages/babel-plugin-jsx/test/resolve-type.test.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ describe('resolve type', () => {
1212
const App = defineComponent((props: Props) => <div />)
1313
`,
1414
{
15-
plugins: [[typescript, { isTSX: true }], VueJsx],
15+
plugins: [
16+
[typescript, { isTSX: true }],
17+
[VueJsx, { resolveType: true }],
18+
],
1619
}
1720
);
1821
expect(result!.code).toMatchSnapshot();

0 commit comments

Comments
 (0)