{"id":20689,"library":"vite-plugin-vue2","title":"vite-plugin-vue2","description":"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.","status":"maintenance","version":"2.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/underfin/vite-plugin-vue2","tags":["javascript","vite","vue2","typescript"],"install":[{"cmd":"npm install vite-plugin-vue2","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-vue2","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-vue2","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for plugin compatibility","package":"vite","optional":false},{"reason":"peer dependency, required for template compilation in Vue 2.x","package":"vue-template-compiler","optional":false}],"imports":[{"note":"Named export, not default. ESM only.","wrong":"import createVuePlugin from 'vite-plugin-vue2'","symbol":"createVuePlugin","correct":"import { createVuePlugin } from 'vite-plugin-vue2'"},{"note":"CommonJS require will fail; package is ESM-only.","wrong":"const vitePluginVue2 = require('vite-plugin-vue2')","symbol":"vite-plugin-vue2","correct":"import { createVuePlugin } from 'vite-plugin-vue2'"},{"note":"Dynamic import works in ESM contexts.","wrong":"","symbol":"createVuePlugin","correct":"const { createVuePlugin } = await import('vite-plugin-vue2')"}],"quickstart":{"code":"// vite.config.js\nimport { createVuePlugin } from 'vite-plugin-vue2'\n\nexport default {\n  plugins: [\n    createVuePlugin({\n      vueTemplateOptions: {\n        compilerOptions: { whitespace: 'condense' }\n      },\n      jsx: true,\n      target: 'es2015'\n    })\n  ]\n}","lang":"typescript","description":"Shows basic setup with createVuePlugin, enabling JSX, and setting esbuild target."},"warnings":[{"fix":"Migrate to @vitejs/plugin-vue2 if using Vue >=2.7.","message":"This plugin is in maintenance mode; use @vitejs/plugin-vue2 for Vue 2.7+.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Ensure vue-template-compiler@^2.2.0 matches the Vue 2 version.","message":"Requires vue-template-compiler peer dependency, which must match the Vue version exactly.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use ESM imports or dynamic import.","message":"The plugin is ESM-only; CommonJS require() will throw an error.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Set { vueTemplateOptions: { compilerOptions: { whitespace: 'preserve' } } } to keep whitespace.","message":"Default whitespace mode is 'condense', which may alter whitespace in templates.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Check changelog for migration if upgrading from v1.","message":"Removed support for vite-plugin-vue2 <2.0.0? (No breaking changes documented but version jump).","severity":"breaking","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use `import { createVuePlugin } from 'vite-plugin-vue2'`","cause":"Using default import instead of named import.","error":"Error: The package \"vite-plugin-vue2\" is not a valid Vite plugin, did you mean to use `import { createVuePlugin } from 'vite-plugin-vue2'`?"},{"fix":"Run `npm install vue-template-compiler@^2.2.0`","cause":"Missing peer dependency vue-template-compiler.","error":"Cannot find module 'vue-template-compiler'"},{"fix":"Use @vitejs/plugin-vue2 for Vue 2.7+.","cause":"Plugin only supports Vue 2.6 and earlier.","error":"Error: Vue 2.7 is not supported by vite-plugin-vue2. Please use @vitejs/plugin-vue2."},{"fix":"Use ESM `import` or dynamic `import()`.","cause":"CommonJS require() used on an ESM-only package.","error":"SyntaxError: Unexpected token 'export'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}