{"_id":"@anontokyo/plugin-vue2","name":"@anontokyo/plugin-vue2","dist-tags":{"latest":"2.4.0"},"versions":{"2.4.0":{"name":"@anontokyo/plugin-vue2","version":"2.4.0","license":"MIT","author":{"name":"Evan You"},"packageManager":"bun@1.3.13","workspaces":["playground"],"publishConfig":{"access":"public"},"main":"./dist/index.cjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"scripts":{"dev":"unbuild --stub","build":"unbuild && esno scripts/patchCJS.ts","test":"vitest run","release":"node scripts/release.js","changelog":"conventional-changelog -p angular -i CHANGELOG.md -s"},"engines":{"node":">=20.19.0"},"repository":{"type":"git","url":"git+https://github.com/vitejs/vite-plugin-vue2.git","directory":"packages/plugin-vue"},"bugs":{"url":"https://github.com/vitejs/vite-plugin-vue2/issues"},"homepage":"https://github.com/vitejs/vite-plugin-vue2/#readme","peerDependencies":{"vite":"^8.0.0","vue":"^2.7.0"},"devDependencies":{"@types/fs-extra":"^9.0.13","conventional-changelog-cli":"^2.2.2","debug":"^4.3.4","enquirer":"^2.3.6","esno":"^0.16.3","execa":"^4.1.0","fs-extra":"^10.1.0","hash-sum":"^2.0.0","minimist":"^1.2.6","picocolors":"^1.0.0","prettier":"^2.7.1","puppeteer":"^14.4.0","semver":"^7.3.7","source-map":"^0.6.1","typescript":"^5.5.4","unbuild":"^2.0.0","vite":"^8.0.0","vitest":"^4.0.0","vue":"^2.7.0"},"gitHead":"2566c304ab5c80290db42014d798b04251b66087","_id":"@anontokyo/plugin-vue2@2.4.0","description":"> [!CAUTION] > Vue 2 has reached EOL, and this project is no longer actively maintained.","_nodeVersion":"26.7.0","_npmVersion":"11.19.0","dist":{"integrity":"sha512-GMMS4vH/TnH60EF3x6EVZyECaG1J305C5KEwEawe5/8l6h48niA9w5pyEtK2TDn1TC9+xWhmvswa+G4c+rZVcw==","shasum":"1a5d88c63bb83b547f814354a7a3d8214a390895","tarball":"https://registry.npmjs.org/@anontokyo/plugin-vue2/-/plugin-vue2-2.4.0.tgz","fileCount":8,"unpackedSize":84959,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDZEjra/Km6rshk+Ho9fmTNmJvIYCH7xYMKUEd7a8DDNQIgcVJxM8Z0GdUGbO/uFD423Ig3xLwQ+vzH4+chQxT2KYI="}]},"_npmUser":{"name":"reach!","email":"paopaothemonster@gmail.com"},"directories":{},"maintainers":[{"name":"reach!","email":"paopaothemonster@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/plugin-vue2_2.4.0_1786957641281_0.6136240017604919"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-17T09:07:20.611Z","2.4.0":"2026-08-17T09:07:21.475Z","modified":"2026-08-17T09:07:21.994Z"},"maintainers":[{"name":"reach!","email":"paopaothemonster@gmail.com"}],"description":"> [!CAUTION] > Vue 2 has reached EOL, and this project is no longer actively maintained.","homepage":"https://github.com/vitejs/vite-plugin-vue2/#readme","repository":{"type":"git","url":"git+https://github.com/vitejs/vite-plugin-vue2.git","directory":"packages/plugin-vue"},"author":{"name":"Evan You"},"bugs":{"url":"https://github.com/vitejs/vite-plugin-vue2/issues"},"license":"MIT","readme":"# @vitejs/plugin-vue2 [![npm](https://img.shields.io/npm/v/@vitejs/plugin-vue2.svg)](https://npmjs.com/package/@vitejs/plugin-vue2)\n\n> [!CAUTION]\n> Vue 2 has reached EOL, and this project is no longer actively maintained.\n\n---\n\n> Note: this plugin only works with Vue@^2.7.0.\n\n```js\n// vite.config.js\nimport vue from '@vitejs/plugin-vue2'\n\nexport default {\n  plugins: [vue()]\n}\n```\n\n## Options\n\n```ts\nexport interface Options {\n  include?: string | RegExp | (string | RegExp)[]\n  exclude?: string | RegExp | (string | RegExp)[]\n\n  isProduction?: boolean\n\n  // options to pass on to vue/compiler-sfc\n  script?: Partial<Pick<SFCScriptCompileOptions, 'babelParserPlugins'>>\n  template?: Partial<\n    Pick<\n      SFCTemplateCompileOptions,\n      | 'compiler'\n      | 'compilerOptions'\n      | 'preprocessOptions'\n      | 'transpileOptions'\n      | 'transformAssetUrls'\n      | 'transformAssetUrlsOptions'\n    >\n  >\n  style?: Partial<Pick<SFCStyleCompileOptions, 'trim'>>\n}\n```\n\n## Asset URL handling\n\nWhen `@vitejs/plugin-vue2` compiles the `<template>` blocks in SFCs, it also converts any encountered asset URLs into ESM imports.\n\nFor example, the following template snippet:\n\n```vue\n<img src=\"../image.png\" />\n```\n\nIs the same as:\n\n```vue\n<script setup>\nimport _imports_0 from '../image.png'\n</script>\n```\n\n```vue\n<img :src=\"_imports_0\" />\n```\n\nBy default the following tag/attribute combinations are transformed, and can be configured using the `template.transformAssetUrls` option.\n\n```js\n{\n  video: ['src', 'poster'],\n  source: ['src'],\n  img: ['src'],\n  image: ['xlink:href', 'href'],\n  use: ['xlink:href', 'href']\n}\n```\n\nNote that only attribute values that are static strings are transformed. Otherwise, you'd need to import the asset manually, e.g. `import imgUrl from '../image.png'`.\n\n## Example for passing options to `vue/compiler-sfc`:\n\n```ts\nimport vue from '@vitejs/plugin-vue2'\n\nexport default {\n  plugins: [\n    vue({\n      template: {\n        compilerOptions: {\n          // ...\n        },\n        transformAssetUrls: {\n          // ...\n        }\n      }\n    })\n  ]\n}\n```\n\n## Example for transforming custom blocks\n\n```ts\nimport vue from '@vitejs/plugin-vue2'\n\nconst vueI18nPlugin = {\n  name: 'vue-i18n',\n  transform(code, id) {\n    if (!/vue&type=i18n/.test(id)) {\n      return\n    }\n    if (/\\.ya?ml$/.test(id)) {\n      code = JSON.stringify(require('js-yaml').load(code.trim()))\n    }\n    return `export default Comp => {\n      Comp.i18n = ${code}\n    }`\n  }\n}\n\nexport default {\n  plugins: [vue(), vueI18nPlugin]\n}\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-535e2b2eb0db59dec93eefe8844b9c77"}