{"id":21708506,"url":"https://github.com/ufologist/wieldy-webpack","last_synced_at":"2026-02-05T14:03:41.752Z","repository":{"id":51396588,"uuid":"102448004","full_name":"ufologist/wieldy-webpack","owner":"ufologist","description":"易于使用的 webpack","archived":false,"fork":false,"pushed_at":"2023-03-02T19:34:23.000Z","size":765,"stargazers_count":2,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-11T08:37:51.641Z","etag":null,"topics":["webpack"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/ufologist.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}},"created_at":"2017-09-05T07:21:20.000Z","updated_at":"2022-03-09T06:48:45.000Z","dependencies_parsed_at":"2024-11-25T22:40:34.167Z","dependency_job_id":null,"html_url":"https://github.com/ufologist/wieldy-webpack","commit_stats":{"total_commits":75,"total_committers":1,"mean_commits":75.0,"dds":0.0,"last_synced_commit":"ee8f843f2b2fc41eec978a936207b531e785dd9b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufologist%2Fwieldy-webpack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufologist%2Fwieldy-webpack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufologist%2Fwieldy-webpack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ufologist%2Fwieldy-webpack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ufologist","download_url":"https://codeload.github.com/ufologist/wieldy-webpack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248596420,"owners_count":21130700,"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":["webpack"],"created_at":"2024-11-25T22:27:19.232Z","updated_at":"2026-02-05T14:03:36.727Z","avatar_url":"https://github.com/ufologist.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wieldy-webpack\n\n推荐迁移到 [`vue-cli-plugin-wieldy-webpack`](migrate-vue-cli3.md)\n\n[![NPM version][npm-image]][npm-url] [![changelog][changelog-image]][changelog-url] [![license][license-image]][license-url]\n\n[npm-image]: https://img.shields.io/npm/v/wieldy-webpack.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/wieldy-webpack\n[license-image]: https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square\n[license-url]: https://github.com/ufologist/wieldy-webpack/blob/master/LICENSE\n[changelog-image]: https://img.shields.io/badge/CHANGE-LOG-blue.svg?style=flat-square\n[changelog-url]: https://github.com/ufologist/wieldy-webpack/blob/master/CHANGELOG.md\n\n![使用对比](https://github.com/ufologist/wieldy-webpack/blob/master/compare.png?raw=true)\n\n易于使用的 `webpack`\n\n\u003e **将通用的 `webpack` 配置做为一个模块封装起来**\n\u003e\n\u003e * 封装繁琐的配置信息\n\u003e * 提供通用功能\n\u003e * 统一维护管理\n\u003e * 方便升级\n\n## 为什么要易于使用?\n\n* `webpack` 需要的配置项太多了\n  * 并不是每个人都需要深入去了解\n  * 通常只要知道如何配置入口就可以了\n* 每个项目都存在着一些通用的 `webpack` 配置\n  * `babel-loader`\n  * `css-loader`\n  * 等等\n* 每个项目都在一遍又一遍地复制着 `webpack` 的配置文件\n  * 脚手架工程\n  * `webpack.base.conf.js`\n  * `webpack.dev.conf.js`\n  * `webpack.prod.conf.js`\n  * `webpack.test.conf.js`\n* 如果需要添加通用配置, 难道每个项目去修改一遍?\n  * 为了优化性能, 统一添加一个 `image-webpack-loader` 怎么样?\n\n## 怎样才能易于使用?\n\n* 简而言之: **重复的逻辑就需要封装**\n* 但绝不过度封装, 增加学习成本\n* 仅封装配置, 完整的返回 `webpack` 的配置, 可以理解为返回了一份默认的 `webpack` 配置信息\n* 可以对返回的 `webpack` 配置再做扩展以适用不同的项目, 例如支持 `vue`/`react`\n\n## [内置功能](https://github.com/ufologist/wieldy-webpack/blob/master/manual.md)\n\n* 优选的默认配置\n* 多环境构建\n* mock server(扩展了 webpack dev server)\n* 随机端口启动开发服务器(webpack dev server)\n* 组件化构建, 方便提取和使用组件, 不用关心组件依赖的资源和样式\n* 支持多入口配置\n* 入口页面支持 layout 机制\n* 支持根据同一份源码, 生成多份不同的输出结果\n  * 通过动态配置在 HTML 页面/JS 文件中注入参数来实现\n* 支持上传构建后的静态资源到 CDN(ftp)\n\n## 使用方法\n\n### 安装\n\n```\nnpm install webpack@3.x webpack-dev-server@2.x wieldy-webpack@1.x --save-dev\n```\n\n### 新建并配置 `webpack.config.js`\n\n```javascript\nvar wieldyWebpack = require('wieldy-webpack');\n\nmodule.exports = function(env) {\n    return wieldyWebpack.createWebpackConfig(env = env ? env : {}).then(function(webpackConfig) {\n        wieldyWebpack.createEntry('index/index.js', 'index.html', {\n            env: env\n        }).addToWebpackConfig(webpackConfig);\n\n        return webpackConfig;\n    });\n};\n```\n\n## 使用示例\n\n* [简单示例项目](https://github.com/ufologist/wieldy-webpack/tree/master/example/simple)\n* [React 示例项目](https://github.com/ufologist/wieldy-webpack/tree/master/example/react)\n* [Vue2 示例项目](https://github.com/ufologist/wieldy-webpack/tree/master/example/vue2)\n* [多入口示例项目](https://github.com/ufologist/wieldy-webpack/tree/master/example/multiple-entry)\n* [多项目示例项目](https://github.com/ufologist/wieldy-webpack/tree/master/example/multiple-project)\n\n## API\n\n* `wieldyWebpack.createWebpackConfig` 创建 webpack 配置\n* `wieldyWebpack.createEntry` 创建 entry(包括 HTML 入口)\n* `wieldyWebpack.useLayout` 使用 layout 模版\n\n## 常见问题\n\n* [FAQ](https://github.com/ufologist/wieldy-webpack/tree/master/FAQ.md)\n\n## 其他实践\n\n* [ElemeFE/cooking](https://github.com/ElemeFE/cooking)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fufologist%2Fwieldy-webpack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fufologist%2Fwieldy-webpack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fufologist%2Fwieldy-webpack/lists"}