- Vue JSX plugin for Vue 3.
- Supports Rollup, Rolldown, Vite, esbuild, Webpack and more.
npm i -D unplugin-vue-jsx
Vite
// vite.config.ts
import Starter from 'unplugin-vue-jsx/vite'
export default defineConfig({
plugins: [Starter()],
})
Rollup
// rollup.config.js
import Starter from 'unplugin-vue-jsx/rollup'
export default {
plugins: [Starter()],
}
Rolldown
// rolldown.config.js
import Starter from 'unplugin-vue-jsx/rolldown'
export default {
plugins: [Starter()],
}
esbuild
import { build } from 'esbuild'
import Starter from 'unplugin-vue-jsx/esbuild'
build({
plugins: [Starter()],
})
Webpack
// webpack.config.js
import Starter from 'unplugin-vue-jsx/webpack'
export default {
/* ... */
plugins: [Starter()],
}
Rspack
// rspack.config.js
import Starter from 'unplugin-vue-jsx/rspack'
export default {
/* ... */
plugins: [Starter()],
}
The following show the default values of the configuration.
VueJsx({
// filters for transforming targets
include: [/\.[jt]sx$/],
exclude: [/node_modules/],
sourceMap: true,
// See https://babeljs.io/docs/babel-parser#options
parserOpts: {
plugins: [
/* ... */
],
},
// Use extra babel plugins
babelPlugins: [],
// Extra options from Vue Babel plugin: https://github.com/vuejs/babel-plugin-jsx#options
// ...
})
MIT License © 2022-PRESENT Kevin Deng