close
logologo
Guide
Config
Plugin
API
Community
Version
Changelog
Rsbuild 0.x Doc
English
简体中文
Guide
Config
Plugin
API
Community
Changelog
Rsbuild 0.x Doc
English
简体中文
logologo

Getting Started

Introduction
Quick start
Features
Glossary

Framework

React
Vue
Preact
Svelte
Solid

Basic

CLI
Dev server
Output files
Static assets
HTML
JSON
Wasm
TypeScript
Web Workers
Deploy static site
Upgrade Rsbuild

Configuration

Configure Rspack
Configure Rsbuild
Configure SWC

Styling

CSS
CSS Modules
CSS-in-JS
Tailwind CSS v4
Tailwind CSS v3
UnoCSS

Advanced

Path aliases
Environment variables
Hot module replacement
Browserslist
Browser compatibility
Module Federation
Multi-environment builds
Server-side rendering (SSR)
Testing

Optimization

Code splitting
Bundle size optimization
Improve build performance
Inline static assets

Migration

Migrating from Rsbuild 0.x
webpack
Create React App
Vue CLI
Vite
Vite plugin
Modern.js Builder

Debug

Debug mode
Build profiling
Use Rsdoctor

FAQ

General FAQ
Features FAQ
Exceptions FAQ
HMR FAQ
📝 Edit this page on GitHub
Previous PageReact
Next PagePreact

#Vue

This document explains how to build a Vue 3 or Vue 2 application using Rsbuild.

#Create a Vue application

Create a Vue application with Rsbuild using create-rsbuild. Run this command:

npm
yarn
pnpm
bun
npm create rsbuild@latest

Then select Vue 3 or Vue 2 when prompted to "Select framework".

#Vue 3

#Use Vue in an existing project

To compile Vue SFC (Single File Components), register the Rsbuild Vue plugin. The plugin automatically adds the necessary configuration for Vue builds.

For example, register in rsbuild.config.ts:

rsbuild.config.ts
import { defineConfig } from '@rsbuild/core';
import { pluginVue } from '@rsbuild/plugin-vue';

export default defineConfig({
  plugins: [pluginVue()],
});
TIP

For projects using Vue CLI, you can refer to the Vue CLI Migration Guide.

#Use the JSX syntax of Vue

To use the JSX syntax of Vue, you also need to register the @rsbuild/plugin-vue-jsx.

#TypeScript support

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.

#Vue 2

#Use Vue 2 in an existing project

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:

rsbuild.config.ts
import { defineConfig } from '@rsbuild/core';
import { pluginVue2 } from '@rsbuild/plugin-vue2';

export default defineConfig({
  plugins: [pluginVue2()],
});
TIP
  • The Vue 2 plugin only supports Vue >= 2.7.0.
  • For projects using Vue CLI, you can refer to the Vue CLI Migration Guide.

#Use the JSX syntax of Vue

To use the JSX syntax of Vue, you also need to register the @rsbuild/plugin-vue2-jsx.

#Type declarations

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:

src/env.d.ts
declare module '*.vue' {
  import Vue from 'vue';

  export default Vue;
}