{"id":27877050,"url":"https://github.com/cd-fez/es-webpack-engine","last_synced_at":"2025-10-15T20:32:00.832Z","repository":{"id":47876501,"uuid":"129091203","full_name":"cd-fez/es-webpack-engine","owner":"cd-fez","description":"基于webpack的多页面打包方案","archived":false,"fork":false,"pushed_at":"2023-01-25T11:01:02.000Z","size":1402,"stargazers_count":4,"open_issues_count":21,"forks_count":2,"subscribers_count":1,"default_branch":"3.5.3","last_synced_at":"2025-07-20T12:34:22.625Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cd-fez.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-11T12:37:10.000Z","updated_at":"2024-05-10T11:22:59.000Z","dependencies_parsed_at":"2023-01-26T09:16:17.572Z","dependency_job_id":null,"html_url":"https://github.com/cd-fez/es-webpack-engine","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/cd-fez/es-webpack-engine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cd-fez%2Fes-webpack-engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cd-fez%2Fes-webpack-engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cd-fez%2Fes-webpack-engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cd-fez%2Fes-webpack-engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cd-fez","download_url":"https://codeload.github.com/cd-fez/es-webpack-engine/tar.gz/refs/heads/3.5.3","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cd-fez%2Fes-webpack-engine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279111002,"owners_count":26105913,"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-10-15T02:00:07.814Z","response_time":56,"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":["webpack"],"created_at":"2025-05-05T02:55:46.865Z","updated_at":"2025-10-15T20:32:00.800Z","avatar_url":"https://github.com/cd-fez.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# es-webpack-engine\n\n基于webpack的多入口构建方案-内部使用\n\n## 配置\n\n**配置文件 webpack.config.js**\n\n```javascript\nmodule.exports = {\n    output: {\n        // 用于生产环境下的输出目录\n        path: 'web/static-dist/', \n        // 用于开发环境下的输出目录      \n        publicPath: '/static-dist/', \n    },\n    // 共用的依赖\n    libs: { \n        //可以是一个js文件\n        'base': ['libs/base.js'], ,\n        'html5shiv': ['html5shiv'],\n        //也可以是一个npm依赖包\n        'fix-ie': ['console-polyfill', 'respond-js'], \n        'jquery-insertAtCaret': ['libs/js/jquery-insertAtCaret.js'],\n    },\n    // 不需要解析的依赖，加快编译速度\n    noParseDeps: {\n        'jquery': 'jquery/dist/jquery.js',\n        'bootstrap': 'bootstrap/dist/js/bootstrap.js',\n    }\n    // 纯拷贝文件到输出的libs目录下\n    onlyCopys: [ \n    {\n      name: 'es-ckeditor',\n      ignore: [\n        '**/samples/**',\n        '**/lang/!(zh-cn.js)',\n        '**/kityformula/libs/**',\n      ]\n    }]\n};\n\n```\n\n**package.json**\n\n对无关配置进行了省略\n\n```json\n{\n    \"devDependencies\": {\n        \"es-webpack-engine\": \"3.5.0\",\n    },\n    \"scripts\": {\n        \"dev\": \"cross-env NODE_ENV=development nodemon --max_old_space_size=4096 node_modules/es-webpack-engine/dist/webpack.dev.js --parameters webpack.config.js\",\n        \"dev:debug\": \"npm run dev sourcemap:true\",\n        \"dev:custom\": \"npm run dev watch:CustomBundle\",\n        \"compile\": \"node --max_old_space_size=4096 node_modules/es-webpack-engine/dist/webpack.prod.js --parameters webpack.config.js\",\n        \"compile:debug\": \"npm run compile sourcemap:true\",\n        \"compile:custom\": \"npm run compile module:CustomBundle\",\n    }\n}\n\n```\n**nodemon.json**\n\n触发重启node服务\n\n```json\n{\n    \"watch\": [\n        \"webpack.config.js\",\n        \".webpack-watch.log\"\n    ]\n}\n\n```\n\n注意：需手动在项目根目录下，添加`.webpack-watch.log`文件\n\n## 实时编译\n\n实体编译，用于开发模式下，在对前端模块代码修改后，能实时编译生效。\n\n**启动实时编译服务：**\n\n```bash\nnpm run dev\n```\n\n启动服务后，默认会在本地启动[3030端口](http://127.0.0.1:3030)的前端模块实时编译服务。\n\n**可用参数：**\n\n* `port:PORT_NUMBER`：指定服务端口。例如：\n  ```bash\n  npm run dev port:3000\n  ```\n* `sourcemap:true`：生成 Source map；\n* `verbose:true`： 显示编译详情，开启此选项后，控制台会输出每个文件被编译的详情；\n* `analyzer:true`：开启依赖分析工具，打包后文件过大，需要查看都包含了哪些依赖时使用。\n* `watch:PATH`：指定监听实时编译的资源，以加快实时编译的速度。支持指定Bundle、插件、主题的前端资源，例如：\n  ```bash\n  npm run dev watch:CustomBundle # 只监听定制开发的前端资源\n  npm run dev watch:ExamplePlugin # 只监听 Example 插件的前端资源\n  npm run dev watch:example # 只监听 Example 主题的前端资源\n  npm run dev watch:CustomBundle,ExamplePlugin # 也可同时监听多个的前端资源\n  ```\n\n## 编译实体文件\n\n**编译实体文体：**\n\n```bash\nnpm run compile\n```\n\n**可用参数：**\n\n* `sourcemap:true`：生成 Source map；\n* `module:PATH`: 指定只编译的前端资源，以加快编译速度。支持指定Bundle、插件、主题的前端资源，例如：\n  ```bash\n  npm run compile module:CustomBundle # 只编译打包定制开发的前端资源\n  npm run compile module:ExamplePlugin # 只编译打包 Example 插件的前端资源\n  npm run compile module:example # 只编译打包 Example 主题的前端资源\n  npm run compile module:CustomBundle,ExamplePlugin # 也可同时编译打包多个前端资源\n  ```\n\n## 常见错误\n\n### 模块不存在\n\n错误提示：\n\n```\nERROR in multi ....\n    Module not found: Error: Cannot resolve 'file' or 'directory' \n```\n\n解决办法：\n\n```bash\nrm -rf node_modules\nyarn\n```\n\n### app crashed\n\n错误提示：\n\n```\n[nodemon] app crashed - waiting for file changes before starting...\n```\n\n解决办法：\n\n在\b控制台（终端）里输入`rs`,然后回车。\n\n### 内存泄漏\n\n错误提示：\n\n```\n\u003c--- Last few GCs ---\u003e\n\n      14 ms: Mark-sweep 2.2 (37.1) -\u003e 2.1 (38.1) MB, 2.8 / 0 ms [allocation failure] [GC in old space requested].\n      15 ms: Mark-sweep 2.1 (38.1) -\u003e 2.1 (39.1) MB, 1.2 / 0 ms [allocation failure] [GC in old space requested].\n      16 ms: Mark-sweep 2.1 (39.1) -\u003e 2.1 (39.1) MB, 0.9 / 0 ms [last resort gc].\n      17 ms: Mark-sweep 2.1 (39.1) -\u003e 2.1 (39.1) MB, 1.0 / 0 ms [last resort gc].\n...\n\nFATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory\n```\n\n解决办法：\n\n重新执行命令：`npm run dev`或`npm run compile`。\n\n### 端口被占用\n\n```\nevents.js:154\n      throw er; // Unhandled 'error' event\n      ^\n\nError: listen EADDRINUSE 0.0.0.0:3030\n    at Object.exports._errnoException (util.js:893:11)\n    at exports._exceptionWithHostPort (util.js:916:20)\n    at Server.__dirname.Server.Server._listen2 (net.js:1246:14)\n    ....\n```\n\n解决方法：该错误表明你已经开启了一个端口号为3030的服务，需要先把那个服务关掉。\n\n```bash\nlsof -i:3030\nkill -9 xxxxx(PID编号)\n```\n\n### 系统默认最大文件打开数过少\n\n报错信息：\n\n```\nwatch ...  ENOSPC\n```\n解决方法： 在控制台输入\n\n```bash\necho fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf \u0026\u0026 sudo sysctl -p\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcd-fez%2Fes-webpack-engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcd-fez%2Fes-webpack-engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcd-fez%2Fes-webpack-engine/lists"}