Error: Transform failed with 1 error: error: invalid option in transform() call: “JSX”
Solution:
-
- the option “JSX” is invalid due to the old esbuild version
-
- 2. Manually install the latest version of esbuild to solve it, But I think it’s better to update the package.json version of the plug-in
-
- rollback plugin esbuild version: find the esbuild in the package.json plug-in and manually modify the esbuild version: 0.12.7
-
- 3. Install yarn add — dev rollback plugin- [email protected] Can solve
Error reporting: as shown in the following figure
Solution
parkage.json configuration! This is very important
"devDependencies": {
"@vue/compiler-sfc": "3.0.0",
"rollup-plugin-esbuild": "2.5.0",
"rollup-plugin-scss": "2.6.0",
"rollup-plugin-terser": "7.0.2",
"rollup-plugin-vue": "6.0.0-beta.10",
"sass": "1.32.11",
"vite": "1.0.0-rc.1"
}
Rollup.config.ts file configuration
import esbuild from 'rollup-plugin-esbuild'
import vue from 'rollup-plugin-vue'
const scss = require('rollup-plugin-scss');
const dartSass = require('sass');
import { terser } from "rollup-plugin-terser"
export default {
input: 'src/lib/index.ts',
output: [{
globals: {
vue: 'Vue'
},
name: 'Gulu',
file: 'dist/lib/gulu.js',
format: 'umd',
plugins: [terser()]
}, {
name: 'Gulu',
file: 'dist/lib/gulu.esm.js',
format: 'es',
plugins: [terser()]
}],
plugins: [
scss({ include: /\.scss$/, sass: dartSass }),
esbuild({
include: /\.[jt]s$/,
minify: process.env.NODE_ENV === 'production',
target: 'es2015'
}),
vue({
include: /\.vue$/,
})
],
}