The Vue plugin provides support for Vue 3 SFC (Single File Components). The plugin internally integrates vue-loader v17.
For Vue 3 JSX / TSX syntax, please use the Vue JSX plugin.
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 import *.vue
SFC files in your code.
If you need to customize the compilation behavior of Vue, you can use the following configs.
Options passed to vue-loader
, please refer to the vue-loader documentation for detailed usage.
VueLoaderOptions
When chunkSplit.strategy set to split-by-experience
, Rsbuild will automatically split vue
and router
related packages into separate chunks by default:
lib-vue.js
: includes vue, vue-loader, and vue's sub-dependencies (@vue/shared, @vue/reactivity, @vue/runtime-dom, @vue/runtime-core).lib-router.js
: includes vue-router.This option is used to control this behavior and determine whether the vue
and router
related packages need to be split into separate chunks.