Skip to content
218
12

unplugin-vue npm

Unit Test

Transform Vue 3 SFC to JavaScript.

Features

  • ⚡️ Support Vite, Webpack, Vue CLI, Rollup, esbuild and more, powered by unplugin.
  • ✨ Support <script setup> and macros.
  • 🔥 Hot module replacement (HMR) support for Vite.
  • 🔄 Sync code from @vitejs/plugin-vue periodically. Currently based on @vitejs/[email protected].

Installation

bash
npm i -D unplugin-vue
Vite
ts
// vite.config.ts
import Vue from 'unplugin-vue/vite'

export default defineConfig({
  plugins: [Vue()],
})
Rollup
ts
// rollup.config.js
import Vue from 'unplugin-vue/rollup'

export default {
  plugins: [Vue()],
}
Rolldown
ts
// rolldown.config.js
import Vue from 'unplugin-vue/rolldown'

export default {
  plugins: [Vue()],
}
esbuild
ts
import { build } from 'esbuild'
import Vue from 'unplugin-vue/esbuild'

build({
  plugins: [Vue()],
})
Webpack
js
// webpack.config.js
import Vue from 'unplugin-vue/webpack'

export default {
  /* ... */
  plugins: [Vue()],
}
Rspack
ts
// rspack.config.js
import Vue from 'unplugin-vue/rspack'

export default {
  /* ... */
  plugins: [Vue()],
}

Limitations

⚠️ HMR is not supported for Webpack, Vue CLI, and Rspack.

Who is using

Alternatives

Thanks

  • Vite - Next generation frontend tooling. It's fast!
  • unplugin - Unified plugin system for Vite, Rollup, Webpack, and more
  • vite-plugin-vue - This project is inherited from it.

Sponsors

License

MIT License © 2022-PRESENT 三咲智子

Released under the MIT License.