Registry / web-framework / vite-plugin-vue2

vite-plugin-vue2

JSON →
library2.0.3jsnpmunverified

A Vite plugin for Vue 2 (maintenance mode, v2.0.3, last release). Supports Vue 2.6 and earlier; superseded by @vitejs/plugin-vue2 for Vue 2.7+. Provides HMR, custom template options, JSX, and esbuild target. Ships TypeScript types. Requires vite ^2.0.0 || ^3.0.0 || ^4.0.0 and vue-template-compiler ^2.2.0.

npm install vite-plugin-vue2
INSTALL
IMPORT
SIG · VITE-PLUGIN-VUE2
V
vite-plugin-vue2
web-frameworkjavascriptv2.0.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createVuePlugin
import { createVuePlugin } from 'vite-plugin-vue2'
import createVuePlugin from 'vite-plugin-vue2'
Named export, not default. ESM only.
vite-plugin-vue2
import { createVuePlugin } from 'vite-plugin-vue2'
const vitePluginVue2 = require('vite-plugin-vue2')
CommonJS require will fail; package is ESM-only.
createVuePlugin
const { createVuePlugin } = await import('vite-plugin-vue2')
Dynamic import works in ESM contexts.

Shows basic setup with createVuePlugin, enabling JSX, and setting esbuild target.

// vite.config.js import { createVuePlugin } from 'vite-plugin-vue2' export default { plugins: [ createVuePlugin({ vueTemplateOptions: { compilerOptions: { whitespace: 'condense' } }, jsx: true, target: 'es2015' }) ] }
Debug
Known issues
deprecatedThis plugin is in maintenance mode; use @vitejs/plugin-vue2 for Vue 2.7+.
fix
Migrate to @vitejs/plugin-vue2 if using Vue >=2.7.
affects: >=1.0.0
gotchaRequires vue-template-compiler peer dependency, which must match the Vue version exactly.
fix
Ensure vue-template-compiler@^2.2.0 matches the Vue 2 version.
affects: >=1.0.0
gotchaThe plugin is ESM-only; CommonJS require() will throw an error.
fix
Use ESM imports or dynamic import.
affects: >=2.0.0
gotchaDefault whitespace mode is 'condense', which may alter whitespace in templates.
fix
Set { vueTemplateOptions: { compilerOptions: { whitespace: 'preserve' } } } to keep whitespace.
affects: >=1.0.0
breakingRemoved support for vite-plugin-vue2 <2.0.0? (No breaking changes documented but version jump).
fix
Check changelog for migration if upgrading from v1.
affects: >=2.0.0
Errors
Common errors & fixes
Error: The package "vite-plugin-vue2" is not a valid Vite plugin, did you mean to use `import { createVuePlugin } from 'vite-plugin-vue2'`?
Using default import instead of named import.
fix
Use `import { createVuePlugin } from 'vite-plugin-vue2'`
Cannot find module 'vue-template-compiler'
Missing peer dependency vue-template-compiler.
fix
Run `npm install vue-template-compiler@^2.2.0`
Error: Vue 2.7 is not supported by vite-plugin-vue2. Please use @vitejs/plugin-vue2.
Plugin only supports Vue 2.6 and earlier.
fix
Use @vitejs/plugin-vue2 for Vue 2.7+.
SyntaxError: Unexpected token 'export'
CommonJS require() used on an ESM-only package.
fix
Use ESM `import` or dynamic `import()`.
Upgrade
Version history
2.0.3latest on npm
Audit
Dependencies
viterequiredpeer dependency for plugin compatibility
vue-template-compilerrequiredpeer dependency, required for template compilation in Vue 2.x
Agent activity
8 hits · last 30 days
node
6
OpenAI (training)
1
Resources
vite-plugin-vue2 — npm install vite-plugin-vue2 · libregistry