{"id":13675779,"url":"https://github.com/guless/mpx-webpack-plugin","last_synced_at":"2026-02-20T16:36:24.504Z","repository":{"id":57303697,"uuid":"134797307","full_name":"guless/mpx-webpack-plugin","owner":"guless","description":"原生小程序开发定制 webpack 插件套装","archived":false,"fork":false,"pushed_at":"2018-11-06T05:11:52.000Z","size":214,"stargazers_count":39,"open_issues_count":2,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-09-22T15:25:22.614Z","etag":null,"topics":["alipay-app","baidu-app","mini-programs","webpack-loader","webpack-plugin","wechat-app"],"latest_commit_sha":null,"homepage":"https://mpx.guless.com/","language":"JavaScript","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/guless.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-25T03:14:51.000Z","updated_at":"2023-03-03T07:40:47.000Z","dependencies_parsed_at":"2022-08-24T17:10:29.029Z","dependency_job_id":null,"html_url":"https://github.com/guless/mpx-webpack-plugin","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/guless/mpx-webpack-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guless%2Fmpx-webpack-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guless%2Fmpx-webpack-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guless%2Fmpx-webpack-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guless%2Fmpx-webpack-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guless","download_url":"https://codeload.github.com/guless/mpx-webpack-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guless%2Fmpx-webpack-plugin/sbom","scorecard":{"id":449024,"data":{"date":"2025-08-11","repo":{"name":"github.com/guless/mpx-webpack-plugin","commit":"4727eb6ca5ff3b4558b719628f1d4bc0952c54d6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 1/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"93 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-c6rq-rjc2-86v2","Warn: Project is vulnerable to: GHSA-257v-vj4p-3w2h","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-phwq-j96m-2c2q","Warn: Project is vulnerable to: GHSA-ghr5-ch3p-vcr6","Warn: Project is vulnerable to: GHSA-vh7m-p724-62c2","Warn: Project is vulnerable to: GHSA-r9p9-mrjm-926w","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-xf7w-r453-m56c","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-44pw-h2cw-w3vq","Warn: Project is vulnerable to: GHSA-jp4x-w63m-7wgm","Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-pfq8-rq6v-vf5m","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-7r28-3m3f-r2pr","Warn: Project is vulnerable to: GHSA-r8j5-h5cx-65gg","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-282f-qqgm-c34q","Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-779f-wgxg-qr8f","Warn: Project is vulnerable to: GHSA-4xcv-9jjx-gfj3","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-fhjf-83wg-r2j9","Warn: Project is vulnerable to: GHSA-9v62-24cr-58cx","Warn: Project is vulnerable to: GHSA-r8f7-9pfq-mjmv","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-566m-qj78-rww5","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-7mwh-4pqv-wmr8","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-h9rv-jmmf-4pgx","Warn: Project is vulnerable to: GHSA-hxcc-f52p-wc94","Warn: Project is vulnerable to: GHSA-4g88-fppr-53pp","Warn: Project is vulnerable to: GHSA-4jqc-8m5r-9rpr","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-vx3p-948g-6vhq","Warn: Project is vulnerable to: GHSA-j44m-qm6p-hp7m","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-xc7v-wxcw-j472","Warn: Project is vulnerable to: GHSA-cf4h-3jhx-xvhq","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T07:40:20.022Z","repository_id":57303697,"created_at":"2025-08-19T07:40:20.022Z","updated_at":"2025-08-19T07:40:20.022Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29657088,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T16:33:43.953Z","status":"ssl_error","status_checked_at":"2026-02-20T16:33:43.598Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["alipay-app","baidu-app","mini-programs","webpack-loader","webpack-plugin","wechat-app"],"created_at":"2024-08-02T12:01:01.790Z","updated_at":"2026-02-20T16:36:24.488Z","avatar_url":"https://github.com/guless.png","language":"JavaScript","readme":"原生小程序开发套装(Mini Program X)\n-------------------------------\n\n\u003e ⚠️注意：\n\u003e - 该插件仅支持 webpack@4.0 以上的版本。\n\u003e - 该插件仅为使用原生小程序平台提供功能做 webpack 编译支持，因此不提供 `虚拟DOM(Visual DOM)` 支持。如果你喜欢 `VUE` 的开发模式，建议使用 [mpvue](https://github.com/Meituan-Dianping/mpvue) 等其他框架进行开发。\n\n功能特点\n-------\n- 支持多个平台：微信小程序(wechat)、支付宝小程序(alipay)、百度小程序(baidu)。\n- 支持 [**webpack**](https://webpack.js.org/) 所有的功能，包括但不限于插件(plugins)、加载器(loaders)、解析器(resolvers)等。\n- 支持通过 `npm install` 安装第三方的小程序模块(页面，组件等)，也就是说我们可以开发通用的组件并发布到 `npm` 上提供给其他小程序使用。\n\n相关资料\n-------\n- [**mpx-examples**](./examples) - `mpx-webpack-plugin` 插件示例项目。\n- [**mpx-workflow**](https://github.com/guless/mpx-workflow/) - 基于 `mpx-webpack-plugin` 编写的工作流（😂适合拿来主义者😂）。\n- [**mpvue**](https://github.com/Meituan-Dianping/mpvue) - 基于 Vue.js 的小程序开发框架，从底层支持 Vue.js 语法和构建工具体系。\n- [**wepy**](https://github.com/Tencent/wepy) - 小程序组件化开发框架。类 vue 风格，已经被官方(Tencent)收编。\n- [**wxapp-webpack-plugin**](https://github.com/Cap32/wxapp-webpack-plugin) - 📦 微信小程序 webpack 插件。也是单纯的 webpack 编译支持。\n- [**微信小程序开发文档**](https://developers.weixin.qq.com/miniprogram/dev/framework/MINA.html)\n- [**支付宝小程序开发文档**](https://docs.alipay.com/mini/framework/overview)\n- [**百度小程序开发文档**](https://smartapp.baidu.com/docs/develop/tutorial/index/)\n\n起步\n----\n```\nnpm i webpack webpack-cli --save-dev\nnpm i mpx-webpack-plugin --save-dev\n```\n\n配置 npm scripts\n----------------\n```js\n{\n    \"name\": \"awesome-miniprogram\",\n    \"version\": \"1.0.0\",\n    ...\n    \"scripts\": {\n        \"watch\": \"npm run build -- --wacth\",             /*\u003c 开发模式 \u003e*/\n        \"build\": \"webpack --config=./webpack.config.js\"  /*\u003c 生产模式 \u003e*/\n    }\n}\n```\n\n\u003e 💡小技巧：通过 `webpack --env.*` 可以添加自定的命令行参数，例如：我们可以通过 `webpack --env.target=\u003cproduction|development\u003e` 来代替以前使用 `cross-env NODE_ENV=\u003cproduction|development\u003e webpack` 来区分开发环境和生产环境。参考文档：[Environment Variables](https://webpack.js.org/guides/environment-variables/)\n\n配置 webpack.config.js\n---------------------\n```js\nconst MPXPlugin = require(\"mpx-webpack-plugin\");\nconst path = require(\"path\");\n\nmodule.exports = {\n    \"context\": __dirname,\n    \"entry\": \"./src/app\", // 具体如何配置入口点，请参考下面的【小程序入口点(Entry-Points)】。\n    \"output\": {\n        \"path\": path.resolve(__dirname, \"./dist\"),\n        \"filename\": \"[name].js\"\n    },\n    \n    \"plugins\": [\n        new MPXPlugin({ \"platform\": \"wechat\" })\n    ]\n};\n```\n\n通过 `webpack.config.js` 导出多份配置文件，可以一次性编译成多个平台的小程序。\n\n```js\nconst MPXPlugin = require(\"mpx-webpack-plugin\");\nconst path = require(\"path\");\n\nmodule.exports = [\n    {\n        \"context\": __dirname,\n        \"entry\": \"./src/app\", // 具体如何配置入口点，请参考下面的【小程序入口点(Entry-Points)】。\n        \"output\": {\n            \"path\": path.resolve(__dirname, \"./dist/wechat/\"),\n            \"filename\": \"[name].js\"\n        },\n        \n        \"plugins\": [\n            new MPXPlugin({ \"platform\": \"wechat\" })\n        ]\n    },\n    {\n        \"context\": __dirname,\n        \"entry\": \"./src/app\", // 具体如何配置入口点，请参考下面的【小程序入口点(Entry-Points)】。\n        \"output\": {\n            \"path\": path.resolve(__dirname, \"./dist/baidu/\"),\n            \"filename\": \"[name].js\"\n        },\n        \n        \"plugins\": [\n            new MPXPlugin({ \"platform\": \"baidu\" })\n        ]\n    },\n];\n```\n\n### 小程序入口点(Entry-Points)\n定义小程序入口点可以通过以下 3 种配置方式：\n\n- [单一入口点语法(Single Entry Syntax)](https://webpack.js.org/concepts/entry-points/#single-entry-shorthand-syntax)\n  - 格式：`entry: string`\n  - 示例：\n    ```\n    entry: \"./src/app\"\n    ```\n  \n- [对象语法(Object Syntax)](https://webpack.js.org/concepts/entry-points/#object-syntax)\n  - 格式：`entry: {[entryChunkName: string]: string}`\n  - 示例：\n    ```\n    entry: { \"app\": \"./src/app\" }\n    ```\n  \n- [动态入口点语法(Dynamic Syntax)](https://webpack.js.org/configuration/entry-context/#dynamic-entry)\n  - 格式：`entry: () =\u003e (Single Entry Syntax)|(Object Syntax)|Promise\u003c(Single Entry Syntax)|(Object Syntax)\u003e`\n  - 示例：\n    ```\n    entry: () =\u003e \"./src/app\"\n    entry: () =\u003e ({ \"app\": \"./src/app\" })\n    entry: () =\u003e Promise.resolve(\"./src/app\")\n    entry: () =\u003e Promise.resolve({ \"app\": \"./src/app\" })\n    ```\n    \n\u003e使用对象语法(Object Syntax)指定小程序入口点时，建议使用 `\"app\"` 作为入口点的名称(entryChunkName)。\n \n MPXPlugin( options )\n--------------------\n\n### Options \n\n 类型      | 名称                  | 默认值            | 说明\n----------|-----------------------|------------------|--------------------\n {string} | name                  | `\"app\"`          | 指定小程序入口点的名称。如果使用对象语法(Object Syntax)配置 `entry`，则插件通过该字段查找小程序的入口点。\n {string} | platform              | `\"wechat\"`       | 指定运行的小程序平台，可选值：`[\"wechat\", \"alipay\", \"baidu\"]`。\u003cul\u003e\u003cli\u003e`\"wechat\"`：微信小程序。\u003c/li\u003e\u003cli\u003e`\"alipay\"`：支付宝小程序。\u003c/li\u003e\u003cli\u003e`\"baidu\"`：百度小程序。\u003c/li\u003e\u003c/ul\u003e\n {Array\u0026lt;string\u0026gt;} | chunks   | `undefined`      | 当使用 `splitChunks` 分离公共模块后，通过 `chunks` 将公共模块插入到 `app.js` 之前。","funding_links":[],"categories":["插件"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguless%2Fmpx-webpack-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguless%2Fmpx-webpack-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguless%2Fmpx-webpack-plugin/lists"}