Skip to content

Commit

Permalink
fix: issue introduced by @vue/babel-plugin-jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwcx committed Jan 11, 2024
1 parent 7292825 commit 1e6c37d
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 43 deletions.
82 changes: 41 additions & 41 deletions suites/preset-vue/lib/compiler.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion suites/preset-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"scripts": {
"build": "father build",
"build:deps": "father prebundle",
"build:lib": "tsup",
"build:lib": "tsup --minify",
"dev": "father dev",
"prepublishOnly": "father doctor && npm run build",
"test": "vitest"
Expand Down
19 changes: 18 additions & 1 deletion suites/preset-vue/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import fs from 'node:fs';
import { defineConfig } from 'tsup';

export default defineConfig([
Expand All @@ -14,6 +15,22 @@ export default defineConfig([
external: ['vue/compiler-sfc'],
dts: true,
treeshake: true,
minify: true,
esbuildPlugins: [
{
name: 'resolve-babel-plugin-jsx',
setup(build) {
build.onLoad({ filter: /babel-plugin-jsx.*mjs$/ }, async (args) => {
const code = await fs.promises.readFile(args.path, 'utf-8');
return {
loader: 'js',
contents: code.replace(
'import syntaxJsx from "@babel/plugin-syntax-jsx";',
'const syntaxJsx = require("@babel/plugin-syntax-jsx").default;',
),
};
});
},
},
],
},
]);

1 comment on commit 1e6c37d

@vercel
Copy link

@vercel vercel bot commented on 1e6c37d Jan 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

dumi-61lm – ./

dumi-61lm.vercel.app
dumi-61lm-cunxuanwang.vercel.app
dumi-61lm-git-master-cunxuanwang.vercel.app

Please sign in to comment.