Unplugin Vue 3 SFC Transformer

7.1.1 · active · verified Sun Apr 19

unplugin-vue is a versatile utility designed to transform Vue 3 Single File Components (SFCs) into executable JavaScript across various build tools. Currently stable at version 7.1.1, it sees regular updates, often with weekly or bi-weekly bug fixes and minor feature enhancements, mirroring its close ties to the @vitejs/plugin-vue codebase. Its core strength lies in its "unplugin" architecture, enabling a single plugin to integrate seamlessly with Vite, Webpack, Rollup, esbuild, Rspack, Farm, and Rolldown. This broad compatibility differentiates it significantly from bundler-specific alternatives. It fully supports modern Vue features like <script setup> and component macros, and notably provides Hot Module Replacement (HMR) for Vite-based projects. Developers leverage it to process .vue files, making it an essential part of the Vue 3 development ecosystem for cross-platform build environments.

Common errors

Warnings

Install

Imports

Quickstart

Illustrates how to integrate `unplugin-vue` into a Vite project for processing Vue 3 Single File Components.

import { defineConfig } from 'vite';
import Vue from 'unplugin-vue/vite';

export default defineConfig({
  plugins: [
    Vue({
      /* options */
    }),
  ],
  // Example of a basic Vue component (src/App.vue)
  // <template>
  //   <div>Hello, Vue!</div>
  // </template>
  // <script setup>
  // import { ref } from 'vue';
  // const msg = ref('World');
  // </script>
  // <style scoped>
  // div { color: blue; }
  // </style>
});

view raw JSON →