{"id":18057024,"url":"https://github.com/slashhuang/webpack-crash","last_synced_at":"2026-05-14T23:30:49.496Z","repository":{"id":92750087,"uuid":"96671148","full_name":"slashhuang/webpack-crash","owner":"slashhuang","description":"A webpack crash overview","archived":false,"fork":false,"pushed_at":"2017-07-09T11:03:17.000Z","size":4,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-16T01:44:17.039Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/slashhuang.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-07-09T08:28:42.000Z","updated_at":"2017-07-09T13:31:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"7a03dc4b-921b-43ec-b533-32ba2daf97ef","html_url":"https://github.com/slashhuang/webpack-crash","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/slashhuang/webpack-crash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slashhuang%2Fwebpack-crash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slashhuang%2Fwebpack-crash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slashhuang%2Fwebpack-crash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slashhuang%2Fwebpack-crash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slashhuang","download_url":"https://codeload.github.com/slashhuang/webpack-crash/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slashhuang%2Fwebpack-crash/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273695203,"owners_count":25151482,"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-09-04T02:00:08.968Z","response_time":61,"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":"2024-10-31T02:06:23.752Z","updated_at":"2026-05-14T23:30:49.491Z","avatar_url":"https://github.com/slashhuang.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# webpack-crash\n\na webpack overview for webpack developers\n\n\n## architecture\n\n1. Validate webpack.config Schema （using 'ajv'）*\n\n2. form `Compiler instance `\n\n- webpack.config === Array   ==\u003e `MultiCompiler`\n- webpack.config ==\u003e   `Compiler`\n\n3. `run Compiler`\n\n- if watchMode is true, run `compiler.watch(watchOptions, callback);`\n\n\n\n## compiler生命周期\n\n#### 异步流程`eventEmitter`\n\n1.  `this.applyPluginsAsync(\"before-run\", this, err =\u003e {  step2 })`\n\n2. `this.applyPluginsAsync(\"run\", this, err =\u003e {  step3  })`\n\n3. `this.readRecords(err =\u003e { step4  });`\n\n4. `this.applyPluginsAsync(\"before-compile\", params, err =\u003e {  step5  })`\n\n#### 同步触发所有compile流程\n\n5. `this.applyPlugins(\"compile\", params);  const compilation = this.newCompilation(params); ` step6\n\n#### 异步流程\n\n6. `this.applyPluginsParallel(\"make\", compilation, err =\u003e {  step7 }`\n\n7. `compilation.finish();  compilation.seal(err =\u003e { step8 })`\n\n8. `this.applyPluginsAsync(\"after-compile\", compilation, err =\u003e { step9 })`\n\n#### 编译结束\n\n1.  if(this.applyPluginsBailResult(\"should-emit\", compilation) === false)\n```js\n    if(this.applyPluginsBailResult(\"should-emit\", compilation) === false) {\n        this.applyPlugins(\"done\", stats);\n        return callback(null, stats);\n    }\n```\n\n2. else\n```js\n    this.emitAssets(compilation, err =\u003e {\n        if(compilation.applyPluginsBailResult(\"need-additional-pass\")) {\n            this.applyPluginsAsync(\"additional-pass\", err =\u003e {\n\t\t\t\tif(err) return callback(err);\n\t\t\t\tthis.compile(onCompiled);\n\t\t\t});\n        }\n        this.emitRecords(err =\u003e {\n\t\t\tif(err) return callback(err);\n\t\t\tconst stats = new Stats(compilation);\n\t\t\tstats.startTime = startTime;\n\t\t    stats.endTime = Date.now();\n\t\t\tthis.applyPlugins(\"done\", stats);\n\t\t\treturn callback(null, stats);\n\t\t});\n    })\n```\n\n## 事件触发顺序\n\n1. before-run\n\n2. run\n\n3. before-compile\n\n4. compile [S]\n\n5. make [P]\n\n6. after-compile\n\n7. should-emit [S]\n\n8.2 true\n\n8.2.1 need-additional-pass\n8.2.2 additional-pass\n\n9. done\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslashhuang%2Fwebpack-crash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslashhuang%2Fwebpack-crash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslashhuang%2Fwebpack-crash/lists"}