{"id":16764045,"url":"https://github.com/novlan1/plugin-light","last_synced_at":"2025-03-21T23:33:10.669Z","repository":{"id":62913972,"uuid":"523151917","full_name":"novlan1/plugin-light","owner":"novlan1","description":"uni-app、webpack、Vite 相关的插件","archived":false,"fork":false,"pushed_at":"2025-03-16T15:44:41.000Z","size":8801,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-16T15:46:20.354Z","etag":null,"topics":["stylelint","stylelint-plugin","uni-app","vite","vite-config","vite-plugin","webpack","webpack-config","webpack-loader","webpack-plugin"],"latest_commit_sha":null,"homepage":"https://novlan1.github.io/plugin-light/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/novlan1.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"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}},"created_at":"2022-08-10T00:45:07.000Z","updated_at":"2025-03-16T15:43:43.000Z","dependencies_parsed_at":"2024-06-25T04:47:06.955Z","dependency_job_id":"4ba15ed9-bf78-4e90-9123-b801ba720a6f","html_url":"https://github.com/novlan1/plugin-light","commit_stats":{"total_commits":60,"total_committers":2,"mean_commits":30.0,"dds":0.01666666666666672,"last_synced_commit":"6075f16885c5a2461aa041c7e75b7d602c4a688e"},"previous_names":["novlan1/plugin-light","novlan1/uni-plugin-light"],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novlan1%2Fplugin-light","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novlan1%2Fplugin-light/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novlan1%2Fplugin-light/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/novlan1%2Fplugin-light/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/novlan1","download_url":"https://codeload.github.com/novlan1/plugin-light/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243893622,"owners_count":20364914,"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":["stylelint","stylelint-plugin","uni-app","vite","vite-config","vite-plugin","webpack","webpack-config","webpack-loader","webpack-plugin"],"created_at":"2024-10-13T05:24:20.044Z","updated_at":"2025-03-21T23:33:10.663Z","avatar_url":"https://github.com/novlan1.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- 复制到 docs时，去掉“详细文档”，链接替换: packages/ =\u003e zh/ --\u003e\n\u003c!-- find ./packages -type d -name \"webpack-plugin-*\"  | wc -l  --\u003e\n## Plugin Light\n\n`Plugin Light` 是一个丰富、易用的工具集。包含一些 `Webpack` 相关插件（25+），比如\n\n- [依赖分析 (webpack-plugin-analyze-deps)](./packages/webpack-plugin-analyze-deps/)\n- [脚本分发 (webpack-plugin-dispatch-script)](./packages/webpack-plugin-dispatch-script/)\n- [组件分发 (webpack-plugin-dispatch-vue)](./packages/webpack-plugin-dispatch-vue/)\n- [npm包打包失败修复 (webpack-plugin-fix-npm-package)](./packages/webpack-plugin-fix-npm-package/)\n- [生成版本号 (webpack-plugin-gen-version)](./packages/webpack-plugin-gen-version/)\n- [`rem`转`rpx` (webpack-plugin-rem-to-rpx)](./packages/webpack-plugin-rem-to-rpx/)\n- [`appId`替换 (webpack-plugin-replace-app-id)](./packages/webpack-plugin-replace-app-id/)\n- [拷贝本地文件 (webpack-plugin-transfer-local-file)](./packages/webpack-plugin-transfer-local-file/)\n- ...\n\n\n以及一些 `Webpack Loader`（20+）\n\n- [自定义`ifdef` (webpack-loader-ifdef)](./packages/webpack-loader-ifdef/)\n- [插入全局组件 (webpack-loader-insert-global-comp)](./packages/webpack-loader-insert-global-comp/)\n- [替换三方库 (webpack-loader-replace-library)](./packages/webpack-loader-replace-library/)\n- [`v-lazy`兼容 (webpack-loader-v-lazy)](./packages/webpack-loader-v-lazy/)\n- [替换动态组件 (webpack-loader-transform-dynamic-comp)](./packages/webpack-loader-transform-dynamic-comp/)\n- [替换vue标签 (webpack-loader-replace-template-tag)](./packages/webpack-loader-replace-template-tag/)\n- [替换`v-for`中的`key` (webpack-loader-replace-vue-key)](./packages/webpack-loader-replace-vue-key/)\n- ...\n\n\n一些 `Vite Plugin`（23+）\n\n- [文件后增加代码 (vite-plugin-add-code-at-end)](./packages/vite-plugin-add-code-at-end/)\n- [三方库别名处理 (vite-plugin-alias-for-library)](./packages/vite-plugin-alias-for-library/)\n- [样式关键词编译 (vite-plugin-cross-game-style)](./packages/vite-plugin-cross-game-style/)\n- [跨平台关键词编译 (vite-plugin-cross-platform)](./packages/vite-plugin-cross-platform/)\n- [条件编译 (vite-plugin-ifdef)](./packages/vite-plugin-ifdef/)\n- [版本输出 (vite-plugin-gen-version)](./packages/vite-plugin-gen-version/)\n- [Rem 转换 (vite-plugin-rem-to-rpx)](./packages/vite-plugin-rem-to-rpx/)\n- [动态导入组件语法替换 (vite-plugin-replace-require-dynamic)](./packages/vite-plugin-replace-require-dynamic/)\n- [Vue v-lazy 转换 (vite-plugin-transform-v-lazy)](./packages/vite-plugin-transform-v-lazy/)\n- [Vue @async 异步组件转换 (vite-plugin-transform-async-component)](./packages/vite-plugin-transform-async-component/)\n\n一些 `Webpack` 基础配置\n\n- [非 uni-app Vue2 项目配置 (project-config-vue)](./packages/project-config-vue/)\n- [非 uni-app Vue3 项目配置 (project-config-vite)](./packages/project-config-vite/)\n- [uni-app Vue2 项目配置 (project-config-uni-vue)](./packages/project-config-uni-vue/)\n- [uni-app Vue3 项目配置 (project-config-uni-vite)](./packages/project-config-uni-vite/)\n\nPostcss Plugin\n\n- [移除选择器 (postcss-plugin-remove-selector)](./packages/postcss-plugin-remove-selector/)\n\n基础包\n\n- [公共包 (plugin-light-shared)](./packages/plugin-light-shared/)\n- [Vue2 公共包 (plugin-light-shared-vue2)](./packages/plugin-light-shared-vue2/)\n- [预处理器 (plugin-light-preprocess)](./packages/plugin-light-preprocess/)\n- [Vite 版本的路由读取 (uni-read-pages-vite)](./packages/uni-read-pages-vite/)\n\n| 类型            | 命名             | 数量 |\n| --------------- | ---------------- | ---- |\n| 项目配置        | project-config-* | 4    |\n| 底层依赖        | plugin-light-*   | 3    |\n| Vite 插件       | vite-plugin-*    | 27   |\n| Webpack 插件    | webpack-plugin-* | 25   |\n| Webpack Loader  | webpack-loader-* | 20   |\n| Postcss 插件    | postcss-plugin-* | 2    |\n| ESLint 插件     | eslint-plugin-*  | 1    |\n| ESLint 共享配置 | eslint-config-*  | 2    |\n\n### 安装\n\n每个包名称不同，下面是一个示例：\n\n```bash\nnpm install -D @plugin-light/project-config-vite\n```\n\n### 插件使用示例\n\n```js\n// vue.config.js\n\nconst { DispatchScriptPlugin } = require('@plugin-light/webpack-plugin-dispatch-vue');\n\nlet plugins = []\n\nif (process.env.NODE_ENV === 'production') {\n  // js分发\n  plugins.push(new DispatchScriptPlugin());\n}\n\nmodule.exports = {\n  configureWebpack: {\n    plugins,\n  }\n}\n```\n\n`Webpack Plugin`、`Vite Plugin`、`Project Config` 均可以采用这种引入方式。\n\n\n### Loader 使用示例\n\n每个 `Webpack Loader` 都会导出 `LOADER` 和 `LOADER_PROD` 两个变量，分别对应 `loader.js`、`loader.prod.js` 的文件路径。\n\n业务可以像下面这样使用：\n\n```js\n// vue.config.js\n\nconst { LOADER: ifdef } = require('@plugin-light/webpack-loader-ifdef');\n\nmodule.export = {\n  chainWebpack(config) {\n    config.module\n      .rule('ifdef-loader')\n      // 根据项目实际配置文件类型\n      .test(/press-ui.*(\\.vue|\\.ts|\\.js|\\.css|\\.scss)$/)\n      // 不要配成下面这样，会卡住\n      // .test(/\\.vue|\\.ts|\\.js|\\.css|\\.scss$/) \n      .use(ifdef)\n      .loader(ifdef)\n      .options({\n        context: { H5: true },\n        type: ['css', 'js', 'html'],\n      })\n      .end();\n  }\n}\n```\n\n\n### 详细文档\n\n[点此查看](https://novlan1.github.io/plugin-light/)\n\n\n### 迁移至 `monorepo` \n\n1. `plugin-light` 不再维护，后续只更新 `monorepo` 包。\n\n2. 如需使用 `light-cli publish` 命令，请安装 [webpack-loader-publish](./packages/webpack-loader-publish/)。\n\n3. `sync-repo` 功能已经废弃。\n\n4. `stylelint-plugin/no-useless-css` 插件已经废弃。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnovlan1%2Fplugin-light","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnovlan1%2Fplugin-light","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnovlan1%2Fplugin-light/lists"}