Vue
How to use
Rspack provides two solutions to support Vue:
- Use Rsbuild: Rsbuild provides out-of-the-box support for Vue 3 and Vue 2, allowing you to quickly create a Vue project. See "Rsbuild - Vue 3" or "Rsbuild - Vue 2" for details.
- Manually configure Rspack: You can refer to the current document to manually add configurations for Vue.
Vue 3
Currently, Vue 3 is supported by Rspack. Please make sure your vue-loader version is >= 17.2.2 and configure as follows:
As Rspack natively supports the compilation of CSS modules, you do not need to configure loaders related to CSS. In addition, when you try to use a CSS preprocessor (such as: less), you only need to add the following configuration:
At this time, Rspack will use the built-in CSS processor for post-processing.
If you don't want to generate CSS files, you can also use a combination of css-loader and vue-style-loader:
Besides, as Rspack has built-in TS support, we also support lang="ts" configuration by default:
You can refer to the related example example-vue3.
Vue 2
Rspack has completed compatibility with Vue 2 (using vue-loader@15).
Please make sure to turn off experiments.css when configuring Vue 2 projects or use rules[].type = "javascript/auto" in CSS-related rules:
TypeScript is supported using Rspack's native builtin:swc-loader, see this for details.
You can refer to the related example example-vue2 and example-vue2-ts.
Vue 3 JSX
Since Rspack supports using babel-loader, you can directly use the @vue/babel-plugin-jsx plugin to support Vue 3 JSX syntax.
Install
First, you need to install babel-loader, @babel/core and @vue/babel-plugin-jsx:
Configure
Then add the following configuration to support Vue 3 JSX syntax in .jsx files:
Rspack provides a example of Vue JSX for reference.

