{"id":26235969,"url":"https://github.com/helti/webpack-m-pages","last_synced_at":"2025-04-22T17:05:25.425Z","repository":{"id":20694631,"uuid":"90636445","full_name":"HelTi/webpack-m-pages","owner":"HelTi","description":":clap: webpack多页配置","archived":false,"fork":false,"pushed_at":"2023-03-04T02:35:55.000Z","size":1280,"stargazers_count":74,"open_issues_count":3,"forks_count":20,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-14T21:52:29.187Z","etag":null,"topics":["webpack"],"latest_commit_sha":null,"homepage":"","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/HelTi.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":"2017-05-08T14:17:35.000Z","updated_at":"2022-10-27T02:13:53.000Z","dependencies_parsed_at":"2023-01-12T03:30:46.531Z","dependency_job_id":null,"html_url":"https://github.com/HelTi/webpack-m-pages","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelTi%2Fwebpack-m-pages","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelTi%2Fwebpack-m-pages/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelTi%2Fwebpack-m-pages/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelTi%2Fwebpack-m-pages/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HelTi","download_url":"https://codeload.github.com/HelTi/webpack-m-pages/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243330704,"owners_count":20274110,"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":"2025-03-13T03:19:09.032Z","updated_at":"2025-03-13T03:19:09.493Z","avatar_url":"https://github.com/HelTi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# webpack多页配置\n**当前webpack版本v4**\n## 功能 \n- [x] css压缩，scss编译  \n- [x] 使用npm包  \n- [x] js压缩  \n- [x] 动态读取入口配置文件   \n- [x] 动态设置HtmlWebpackPlugin实现多页打包配置\n- [x] 启动webpack-dev-server（自动刷新）  \n- [x] eslint校验  \n- [ ] 动态cdn配置 （公共库使用cdn，也就是通过css标签和script标签引入，避免使用webpack打包，从而降低打包体积与访问速度）   \n- [ ] web.config.js增加对webpack配置运行扩展\n\n## web.config.js配置文件\n参数|说明|类型|默认值\n---|:--:|:---:|---:\npublicPath|webpack的打包公共路径|string| /\nport|webpack-dev-server的端口号|number| 3000\nhost|webpack-dev-server的服务host|string| localhost\nexternals|webpack的externals|object| {}\nalias|webpack的alias|object| {}\n \n## 页面路径规则\n**保持html文件名与入口js文件名一致，使用glob模块，动态读取文件夹生成配置**\n### 示例\n```\n    └─pages //页面配置目录\n        ├─index\n        │      index.html\n        │      index.js\n        │      \n        ├─pageA\n        │      pageA.html\n        │      pageA.js\n        │      \n        └─pageB\n                pageB.html\n                pageB.js\n```\n\n## 目录结构说明\n```\n├── config\n│   ├── createHtmlWebpackplugin.js\n│   ├── entrys.js\n│   ├── utils.js\n│   ├── webpack.common.js  // webpack公共配置\n│   ├── webpack.dev.js\n│   └── webpack.prd.js\n├── package-lock.json\n├── package.json\n├── prettier.config.js\n├── src\n│   ├── assets  // 静态资源文件夹\n│   ├── pages   // 页面目录\n│   ├── static  // 静态文件夹,会原样的打包到根目录不做资源处理\n│   └── utils\n└── web.config.js  //一些常用的webpack配置选项\n            \n```\n## 安装依赖\n\u003e npm install\n## 打包\n\u003e npm run build\n## 启动服务\n\u003e npm run start\n\u003e启动服务后访问\n- http://localhost:3000/\n- http://localhost:3000/pageA.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelti%2Fwebpack-m-pages","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelti%2Fwebpack-m-pages","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelti%2Fwebpack-m-pages/lists"}