{"id":13606792,"url":"https://github.com/vitejs/vite-plugin-vue2","last_synced_at":"2025-05-13T19:07:16.980Z","repository":{"id":37040962,"uuid":"504375714","full_name":"vitejs/vite-plugin-vue2","owner":"vitejs","description":"Vite plugin for Vue 2.7","archived":false,"fork":false,"pushed_at":"2024-11-26T15:18:51.000Z","size":160,"stargazers_count":565,"open_issues_count":43,"forks_count":52,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-25T18:21:56.887Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vitejs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"vitejs","open_collective":"vite"}},"created_at":"2022-06-17T03:01:04.000Z","updated_at":"2025-04-22T01:09:33.000Z","dependencies_parsed_at":"2024-01-07T18:05:50.301Z","dependency_job_id":"179c9bb3-a9b3-4c8d-b847-173097becfe9","html_url":"https://github.com/vitejs/vite-plugin-vue2","commit_stats":{"total_commits":61,"total_committers":19,"mean_commits":3.210526315789474,"dds":0.6065573770491803,"last_synced_commit":"8de73ea6b8a1df4c14308da2885db195dacc2b14"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitejs%2Fvite-plugin-vue2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitejs%2Fvite-plugin-vue2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitejs%2Fvite-plugin-vue2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitejs%2Fvite-plugin-vue2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vitejs","download_url":"https://codeload.github.com/vitejs/vite-plugin-vue2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250869877,"owners_count":21500397,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T19:01:12.452Z","updated_at":"2025-04-27T04:46:43.712Z","avatar_url":"https://github.com/vitejs.png","language":"TypeScript","funding_links":["https://github.com/sponsors/vitejs","https://opencollective.com/vite"],"categories":["Plugins"],"sub_categories":["Framework-agnostic Plugins","Vue"],"readme":"# @vitejs/plugin-vue2 [![npm](https://img.shields.io/npm/v/@vitejs/plugin-vue2.svg)](https://npmjs.com/package/@vitejs/plugin-vue2)\n\n\u003e [!CAUTION]\n\u003e Vue 2 has reached EOL, and this project is no longer actively maintained.\n\n---\n\n\u003e 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\u003cPick\u003cSFCScriptCompileOptions, 'babelParserPlugins'\u003e\u003e\n  template?: Partial\u003c\n    Pick\u003c\n      SFCTemplateCompileOptions,\n      | 'compiler'\n      | 'compilerOptions'\n      | 'preprocessOptions'\n      | 'transpileOptions'\n      | 'transformAssetUrls'\n      | 'transformAssetUrlsOptions'\n    \u003e\n  \u003e\n  style?: Partial\u003cPick\u003cSFCStyleCompileOptions, 'trim'\u003e\u003e\n}\n```\n\n## Asset URL handling\n\nWhen `@vitejs/plugin-vue2` compiles the `\u003ctemplate\u003e` blocks in SFCs, it also converts any encountered asset URLs into ESM imports.\n\nFor example, the following template snippet:\n\n```vue\n\u003cimg src=\"../image.png\" /\u003e\n```\n\nIs the same as:\n\n```vue\n\u003cscript setup\u003e\nimport _imports_0 from '../image.png'\n\u003c/script\u003e\n```\n\n```vue\n\u003cimg :src=\"_imports_0\" /\u003e\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\u0026type=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 =\u003e {\n      Comp.i18n = ${code}\n    }`\n  }\n}\n\nexport default {\n  plugins: [vue(), vueI18nPlugin]\n}\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitejs%2Fvite-plugin-vue2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvitejs%2Fvite-plugin-vue2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitejs%2Fvite-plugin-vue2/lists"}