The Vue 2 plugin provides support for Vue 2 SFC (Single File Components). The plugin internally integrates vue-loader v15.
The Vue 2 plugin only supports Vue >= 2.7.0.
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
files in your code or use Vue's JSX syntax without the need for additional configuration.
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
The Vue 2 plugin is using the vue-loader
v15. Please be aware that there may be configuration differences between v15 and the latest version.
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.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.