The Vue plugin provides support for Vue 3 JSX / TSX syntax. The plugin internally integrates @vue/babel-plugin-jsx.
You can install the plugin using the following command:
You can register the plugin in the rsbuild.config.ts
file:
After registering the plugin, you can use Vue's JSX / TSX syntax in your code.
Since the Vue JSX plugin relies on Babel for compilation, you need to additionally add the Babel plugin.
Babel compilation will introduce extra overhead, in the example above, we use include
to match .jsx
and .tsx
files, thereby reducing the performance cost brought by Babel.
When using Vue >= 3.3, please set "jsxImportSource": "vue"
in tsconfig.json
to enable JSX type inference.
For more details, see Vue - JSX Type Inference.
If you need to customize the compilation behavior of Vue, you can use the following configs.
Options passed to @vue/babel-plugin-jsx
, please refer to the @vue/babel-plugin-jsx documentation for detailed usage.
Default: {}
Example: