{"id":20973584,"url":"https://github.com/wx-dongxing/unplugin-web-components","last_synced_at":"2025-08-29T17:40:05.891Z","repository":{"id":65390683,"uuid":"562807435","full_name":"WX-DongXing/unplugin-web-components","owner":"WX-DongXing","description":"Building vue3 components to webComponents on vite","archived":false,"fork":false,"pushed_at":"2022-11-11T10:34:49.000Z","size":70,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-09T18:17:44.773Z","etag":null,"topics":["vite","vue3","webcomponents"],"latest_commit_sha":null,"homepage":"","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/WX-DongXing.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-07T09:52:59.000Z","updated_at":"2023-01-21T18:17:33.000Z","dependencies_parsed_at":"2023-01-21T23:05:06.500Z","dependency_job_id":null,"html_url":"https://github.com/WX-DongXing/unplugin-web-components","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/WX-DongXing/unplugin-web-components","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WX-DongXing%2Funplugin-web-components","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WX-DongXing%2Funplugin-web-components/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WX-DongXing%2Funplugin-web-components/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WX-DongXing%2Funplugin-web-components/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WX-DongXing","download_url":"https://codeload.github.com/WX-DongXing/unplugin-web-components/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WX-DongXing%2Funplugin-web-components/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272733351,"owners_count":24984261,"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","status":"online","status_checked_at":"2025-08-29T02:00:10.610Z","response_time":87,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["vite","vue3","webcomponents"],"created_at":"2024-11-19T04:20:06.829Z","updated_at":"2025-08-29T17:40:05.863Z","avatar_url":"https://github.com/WX-DongXing.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# unplugin-web-components\n\nBuilding vue3 components to webComponents on vite\n\n## Install\n\n```bash\nnpm i -D unplugin-web-components\n```\n\n## Use\n\n`lib/index.ts`\n\n```typescript\nimport { defineCustomElement } from 'vue'\nimport { styles } from 'virtual:unplugin-web-components'\nimport Example from '@/components/Example.vue'\n\nconst WCExample = defineCustomElement(Object.assign(WCExample, { styles }))\n\ncustomElement.define('wc-example', WCExample)\n```\n\n`env.d.ts`\n\n```typescript\ndeclare module 'virtual:unplugin-web-components' {\n  export const styles: string[]\n}\n```\n\n`vite.config.ts`\n\n```typescript\nimport vue from '@vitejs/plugin-vue'\nimport WebComponents from 'unplugin-web-components/vite'\n\nexport default defineConfig({\n  define: { 'process.env.NODE_ENV': '\"production\"' },\n  plugins: [vue(), WebComponents()],\n  build: {\n    lib: {\n      name: 'WCExample',\n      formats: ['es', 'umd']\n      entry: resolve(__dirname, 'lib/index.ts'),\n      fileName: (format) =\u003e `wc-example.${format}.js`,\n    }\n  }\n})\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eVite\u003c/summary\u003e\u003cbr\u003e\n\n```ts\n// vite.config.ts\nimport WebComponents from 'unplugin-web-components/vite'\n\nexport default defineConfig({\n  plugins: [\n    WebComponents({\n      /* options */\n    })\n  ]\n})\n```\n\nExample: [`playground/`](./playground/)\n\n\u003cbr\u003e\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eRollup\u003c/summary\u003e\u003cbr\u003e\n\n```ts\n// rollup.config.js\nimport WebComponents from 'unplugin-web-components/rollup'\n\nexport default {\n  plugins: [\n    WebComponents({\n      /* options */\n    })\n  ]\n}\n```\n\n\u003cbr\u003e\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eWebpack\u003c/summary\u003e\u003cbr\u003e\n\n```ts\n// webpack.config.js\nmodule.exports = {\n  /* ... */\n  plugins: [\n    require('unplugin-web-components/webpack')({\n      /* options */\n    })\n  ]\n}\n```\n\n\u003cbr\u003e\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eNuxt\u003c/summary\u003e\u003cbr\u003e\n\n```ts\n// nuxt.config.js\nexport default {\n  buildModules: [\n    [\n      'unplugin-web-components/nuxt',\n      {\n        /* options */\n      }\n    ]\n  ]\n}\n```\n\n\u003e This module works for both Nuxt 2 and [Nuxt Vite](https://github.com/nuxt/vite)\n\n\u003cbr\u003e\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eVue CLI\u003c/summary\u003e\u003cbr\u003e\n\n```ts\n// vue.config.js\nmodule.exports = {\n  configureWebpack: {\n    plugins: [\n      require('unplugin-web-components/webpack')({\n        /* options */\n      })\n    ]\n  }\n}\n```\n\n\u003cbr\u003e\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eesbuild\u003c/summary\u003e\u003cbr\u003e\n\n```ts\n// esbuild.config.js\nimport { build } from 'esbuild'\nimport WebComponents from 'unplugin-web-components/esbuild'\n\nbuild({\n  plugins: [WebComponents()]\n})\n```\n\n\u003cbr\u003e\u003c/details\u003e\n\n## License\n\n[MIT](https://github.com/WX-DongXing/unplugin-web-components/blob/main/LICENSE)\n\nCopyright (c) 2022 Dong Xing\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwx-dongxing%2Funplugin-web-components","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwx-dongxing%2Funplugin-web-components","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwx-dongxing%2Funplugin-web-components/lists"}