In this document, you will learn how to build a Vue 3 or Vue 2 application using Rsbuild.
You can use create-rsbuild
to create a project with Rsbuild + Vue. Just execute the following command:
Then select Vue 3
or Vue 2
when prompted to "Select framework".
To compile Vue SFC (Single File Components), you need to register the Rsbuild Vue plugin. The plugin will automatically add the necessary configuration for Vue builds.
For example, register in rsbuild.config.ts
:
For projects using Vue CLI, you can refer to the Vue CLI Migration Guide.
If you need to use the JSX syntax of Vue, you also need to register the @rsbuild/plugin-vue-jsx.
Rsbuild supports compiling TypeScript by default.
Please refer to the TypeScript - IDE Support section of the Vue documentation to learn how to set up Vue TypeScript support in your IDE.
To compile Vue SFC (Single File Components), you need to register the Rsbuild Vue 2 plugin. The plugin will automatically add the necessary configuration for Vue builds.
For example, register in rsbuild.config.ts
:
If you need to use the JSX syntax of Vue, you also need to register the @rsbuild/plugin-vue2-jsx.
In a TypeScript project, you need to add type definitions for *.vue
files so that TypeScript can recognize them correctly.
Create env.d.ts
in the src
directory and add the following content: