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.
npm install unplugin-vueVerified import paths — ran on the pinned version, not inferred.
Illustrates how to integrate `unplugin-vue` into a Vite project for processing Vue 3 Single File Components.
Consider using Vite for projects where HMR is critical, or be aware of manual page reloads when developing with unsupported bundlers.
Upgrade your Node.js environment to version 20.19.0 or newer. Use a Node Version Manager (e.g., nvm) for easy switching.
Verify and update your `vue` dependency in `package.json` to a compatible version (e.g., `vue@latest`). Run `npm install` or `yarn install` afterwards.
Always review the changelogs for both `unplugin-vue` and `@vitejs/plugin-vue` when performing major or minor upgrades to anticipate potential issues.
Change your import statement to `import Vue from 'unplugin-vue/vite'` (or the relevant bundler path) to correctly import the default export.
Ensure `unplugin-vue` is installed (`npm i -D unplugin-vue`) and you are using the correct import path for your build tool (e.g., `unplugin-vue/webpack` for Webpack, `unplugin-vue/rollup` for Rollup).
Install a compatible version of Vue 3: `npm install vue@latest` or specifically `npm install vue@3.x.x` that matches the peer dependency range.