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
muslnode 18–226 runs
build_error
glibcnode 18–226 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'
})
]
}
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.
fixUse `import { createVuePlugin } from 'vite-plugin-vue2'` Cannot find module 'vue-template-compiler'
Missing peer dependency vue-template-compiler.
fixRun `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.
fixUse @vitejs/plugin-vue2 for Vue 2.7+.
SyntaxError: Unexpected token 'export'
CommonJS require() used on an ESM-only package.
fixUse ESM `import` or dynamic `import()`.
Audit
Dependencies
viterequiredpeer dependency for plugin compatibility
vue-template-compilerrequiredpeer dependency, required for template compilation in Vue 2.x