error: Invalid option in transform() call: “jsx“

created at 11-27-2021 views: 19

error

Error: Transform failed with 1 error: error: Invalid option in transform() call: "jsx"

solution:

  1. Due to the old version of esbuild, the option "jsx" is invalid
  2. Manually install the latest version of esbuild to solve it, but I think it is best to also update the pacakge.json version of the plugin
    rollup-plugin-esbuild version: find the esbuild in the plugin package.json and manually modify the esbuild version: 0.12.7
  3. Install yarn add --dev rollup-plugin-esbuild@2.5.0 to solve

Error

as shown below

error screenshot

solution

parckage.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$/,
        })
    ],
}
created at:11-27-2021
edited at: 11-27-2021: