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$/,
})
],
}
Read More:
- How to Solve Vue cli configuration SCSS global variable error
- [Solved] Node sass version 7.0.0 is incompatible with ^ 4.0.0 | ^ 5.0.0 | ^ 6.0.0
- [Solved] Syntax Error: Error: Loading PostCSS Plugin failed: Cannot find module ‘autoprefixer‘
- [Solved] Vite packing error: some chunks are larger than 500kb after minification
- [Solved] Syntax Error: TypeError: this.getOptions is not a function
- Vue installs sass loader directly, and node sass reports an error
- npm ERR code ELIFECYCLE [How to Solve]
- [Solved] Syntax Error: Error: Node Sass does not yet support your current environment:
- [Solved] Vue Error: Module build failed Error Node Sass version 6.0.1 is incompatible with ^4.0.0.
- [Solved] hugo Use meme Theme Error: Error: Error building site: TOCSS: failed to transform “en/styles/main-rendered.scss“
- [Solved] scss Error: TypeError: this.getOptions is not a function
- [Solved] Vue Use gzip Package Error: Rule can only have one resource source
- [Solved] Error: ENOENT: no such file or directory, scandir ‘..\node_modules\node-sass\vendor‘
- [Solved] NPM node ERROR in main..js from Terser ChildProcessWorker.initialize Excaption
- Cannot read property ‘isFile‘ of undefined [How to Solve]
- [Solved] SyntaxError: Cannot use import statement outside a module
- [Solved] electron Package and Startup Error: Error: ENOENT: no such file or directory, open ‘xxx/manifest.json‘‘
- [vite] Failed to parse source for import analysis because the content contains invalid JS syntax.
- [Solved] Vue item error: Regeneratorruntime is not defined
- [Solved] Temporary error: Error: spawn E:\vue3-vite\my-app\node_modules\esbuild\esbuild.exe ENOENT