From f3a37ce8f8fef541f29a39c788d480a247aa3c5c Mon Sep 17 00:00:00 2001 From: Aleen Date: Wed, 11 Aug 2021 15:03:50 +0800 Subject: [PATCH 001/151] fix(utils): avoid reserved property under ES --- lib/util/propertyAccess.js | 55 +++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/lib/util/propertyAccess.js b/lib/util/propertyAccess.js index 9a0b6344292..834cda6d55c 100644 --- a/lib/util/propertyAccess.js +++ b/lib/util/propertyAccess.js @@ -6,6 +6,59 @@ "use strict"; const SAFE_IDENTIFIER = /^[_a-zA-Z$][_a-zA-Z$0-9]*$/; +const RESERVED_IDENTIFER = [ + "break", + "case", + "catch", + "class", + "const", + "continue", + "debugger", + "default", + "delete", + "do", + "else", + "export", + "extends", + "finally", + "for", + "function", + "if", + "import", + "in", + "instanceof", + "new", + "return", + "super", + "switch", + "this", + "throw", + "try", + "typeof", + "var", + "void", + "while", + "with", + "enum", + // strict mode + "implements", + "interface", + "let", + "package", + "private", + "protected", + "public", + "static", + "yield", + "yield", + // module code + "await", + // skip future reserved keywords defined under ES1 till ES3 + // additional + "null", + "true", + "false" +]; const propertyAccess = (properties, start = 0) => { let str = ""; @@ -13,7 +66,7 @@ const propertyAccess = (properties, start = 0) => { const p = properties[i]; if (`${+p}` === p) { str += `[${p}]`; - } else if (SAFE_IDENTIFIER.test(p)) { + } else if (SAFE_IDENTIFIER.test(p) && !RESERVED_IDENTIFER.includes(p)) { str += `.${p}`; } else { str += `[${JSON.stringify(p)}]`; From cf4a7c0e7d891f948fedaff38b896a1709b18199 Mon Sep 17 00:00:00 2001 From: Aleen Date: Wed, 11 Aug 2021 15:44:08 +0800 Subject: [PATCH 002/151] dependency: missed jest-cli --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 9bcb17ce1dd..b32518f73b8 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ "is-ci": "^3.0.0", "istanbul": "^0.4.5", "jest": "^27.0.6", + "jest-cli": "^27.0.6", "jest-circus": "^27.0.6", "jest-diff": "^27.0.2", "jest-junit": "^12.0.0", From dc1fbaf9deee6ad7bad4688562fde6239824fadb Mon Sep 17 00:00:00 2001 From: Aleen Date: Wed, 11 Aug 2021 16:01:16 +0800 Subject: [PATCH 003/151] test: update corresponding snapshot --- .../StatsTestCases.basictest.js.snap | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/test/__snapshots__/StatsTestCases.basictest.js.snap b/test/__snapshots__/StatsTestCases.basictest.js.snap index 65db65d2081..8781f46acd0 100644 --- a/test/__snapshots__/StatsTestCases.basictest.js.snap +++ b/test/__snapshots__/StatsTestCases.basictest.js.snap @@ -254,8 +254,8 @@ default: vendors: Entrypoint main 11 KiB = vendors/main.js Entrypoint a 14.4 KiB = vendors/vendors.js 1.05 KiB vendors/a.js 13.3 KiB - Entrypoint b 8.09 KiB = vendors/vendors.js 1.05 KiB vendors/b.js 7.04 KiB - Entrypoint c 8.09 KiB = vendors/vendors.js 1.05 KiB vendors/c.js 7.04 KiB + Entrypoint b 8.1 KiB = vendors/vendors.js 1.05 KiB vendors/b.js 7.05 KiB + Entrypoint c 8.1 KiB = vendors/vendors.js 1.05 KiB vendors/c.js 7.05 KiB chunk (runtime: b) vendors/b.js (b) 156 bytes (javascript) 2.69 KiB (runtime) [entry] [rendered] > ./b b runtime modules 2.69 KiB 4 modules @@ -303,8 +303,8 @@ vendors: multiple-vendors: Entrypoint main 11.4 KiB = multiple-vendors/main.js Entrypoint a 14.9 KiB = multiple-vendors/libs-x.js 414 bytes multiple-vendors/954.js 414 bytes multiple-vendors/767.js 414 bytes multiple-vendors/390.js 414 bytes multiple-vendors/a.js 13.3 KiB - Entrypoint b 8.04 KiB = multiple-vendors/libs-x.js 414 bytes multiple-vendors/954.js 414 bytes multiple-vendors/767.js 414 bytes multiple-vendors/568.js 414 bytes multiple-vendors/b.js 6.42 KiB - Entrypoint c 8.04 KiB = multiple-vendors/libs-x.js 414 bytes multiple-vendors/769.js 414 bytes multiple-vendors/767.js 414 bytes multiple-vendors/568.js 414 bytes multiple-vendors/c.js 6.42 KiB + Entrypoint b 8.05 KiB = multiple-vendors/libs-x.js 414 bytes multiple-vendors/954.js 414 bytes multiple-vendors/767.js 414 bytes multiple-vendors/568.js 414 bytes multiple-vendors/b.js 6.44 KiB + Entrypoint c 8.05 KiB = multiple-vendors/libs-x.js 414 bytes multiple-vendors/769.js 414 bytes multiple-vendors/767.js 414 bytes multiple-vendors/568.js 414 bytes multiple-vendors/c.js 6.44 KiB chunk (runtime: a, b, c, main) multiple-vendors/libs-x.js (libs-x) (id hint: libs) 20 bytes [initial] [rendered] split chunk (cache group: libs) (name: libs-x) > ./a ./index.js 1:0-47 > ./b ./index.js 2:0-47 @@ -375,8 +375,8 @@ multiple-vendors: all: Entrypoint main 11.4 KiB = all/main.js Entrypoint a 14.9 KiB = all/282.js 414 bytes all/954.js 414 bytes all/767.js 414 bytes all/390.js 414 bytes all/a.js 13.3 KiB - Entrypoint b 8.04 KiB = all/282.js 414 bytes all/954.js 414 bytes all/767.js 414 bytes all/568.js 414 bytes all/b.js 6.42 KiB - Entrypoint c 8.04 KiB = all/282.js 414 bytes all/769.js 414 bytes all/767.js 414 bytes all/568.js 414 bytes all/c.js 6.42 KiB + Entrypoint b 8.05 KiB = all/282.js 414 bytes all/954.js 414 bytes all/767.js 414 bytes all/568.js 414 bytes all/b.js 6.44 KiB + Entrypoint c 8.05 KiB = all/282.js 414 bytes all/769.js 414 bytes all/767.js 414 bytes all/568.js 414 bytes all/c.js 6.44 KiB chunk (runtime: b) all/b.js (b) 116 bytes (javascript) 2.7 KiB (runtime) [entry] [rendered] > ./b b runtime modules 2.7 KiB 4 modules @@ -466,10 +466,10 @@ webpack x.x.x compiled with 1 warning in X ms" exports[`StatsTestCases should print correct stats for chunk-module-id-range 1`] = ` "PublicPath: auto -asset main1.js 4.51 KiB [emitted] (name: main1) -asset main2.js 4.5 KiB [emitted] (name: main2) -Entrypoint main1 4.51 KiB = main1.js -Entrypoint main2 4.5 KiB = main2.js +asset main1.js 4.52 KiB [emitted] (name: main1) +asset main2.js 4.51 KiB [emitted] (name: main2) +Entrypoint main1 4.52 KiB = main1.js +Entrypoint main2 4.51 KiB = main2.js chunk (runtime: main1) main1.js (main1) 189 bytes (javascript) 670 bytes (runtime) [entry] [rendered] > ./main1 main1 runtime modules 670 bytes 3 modules @@ -1353,12 +1353,12 @@ exports[`StatsTestCases should print correct stats for module-deduplication 1`] "asset e1.js 12.1 KiB [emitted] (name: e1) asset e2.js 12.1 KiB [emitted] (name: e2) asset e3.js 12.1 KiB [emitted] (name: e3) -asset 172.js 852 bytes [emitted] -asset 326.js 852 bytes [emitted] -asset 923.js 852 bytes [emitted] -asset 114.js 518 bytes [emitted] -asset 593.js 518 bytes [emitted] -asset 716.js 518 bytes [emitted] +asset 172.js 858 bytes [emitted] +asset 326.js 858 bytes [emitted] +asset 923.js 858 bytes [emitted] +asset 114.js 524 bytes [emitted] +asset 593.js 524 bytes [emitted] +asset 716.js 524 bytes [emitted] chunk (runtime: e1) 114.js 61 bytes [rendered] ./async1.js 61 bytes [built] [code generated] chunk (runtime: e3) e3.js (e3) 249 bytes (javascript) 6.5 KiB (runtime) [entry] [rendered] @@ -1399,9 +1399,9 @@ exports[`StatsTestCases should print correct stats for module-deduplication-name "asset e1.js 11.9 KiB [emitted] (name: e1) asset e2.js 11.9 KiB [emitted] (name: e2) asset e3.js 11.9 KiB [emitted] (name: e3) -asset async1.js 958 bytes [emitted] (name: async1) -asset async2.js 958 bytes [emitted] (name: async2) -asset async3.js 958 bytes [emitted] (name: async3) +asset async1.js 964 bytes [emitted] (name: async1) +asset async2.js 964 bytes [emitted] (name: async2) +asset async3.js 964 bytes [emitted] (name: async3) chunk (runtime: e3) e3.js (e3) 242 bytes (javascript) 6.55 KiB (runtime) [entry] [rendered] runtime modules 6.55 KiB 9 modules cacheable modules 242 bytes @@ -1536,7 +1536,7 @@ exports[`StatsTestCases should print correct stats for named-chunk-groups 1`] = "Chunk Group main 11.6 KiB = a-main.js Chunk Group async-a 1.07 KiB = a-52.js 257 bytes a-async-a.js 836 bytes Chunk Group async-b 1.07 KiB = a-52.js 257 bytes a-async-b.js 836 bytes -Chunk Group async-c 1.44 KiB = a-vendors.js 744 bytes a-async-c.js 735 bytes +Chunk Group async-c 1.45 KiB = a-vendors.js 744 bytes a-async-c.js 741 bytes chunk (runtime: main) a-52.js 149 bytes [rendered] split chunk (cache group: default) > ./a ./index.js 1:0-47 > ./b ./index.js 2:0-47 @@ -1563,7 +1563,7 @@ webpack x.x.x compiled successfully Entrypoint main 11.6 KiB = b-main.js Chunk Group async-a 1.07 KiB = b-52.js 257 bytes b-async-a.js 836 bytes Chunk Group async-b 1.07 KiB = b-52.js 257 bytes b-async-b.js 836 bytes -Chunk Group async-c 1.44 KiB = b-vendors.js 744 bytes b-async-c.js 735 bytes +Chunk Group async-c 1.45 KiB = b-vendors.js 744 bytes b-async-c.js 741 bytes chunk (runtime: main) b-52.js 149 bytes [rendered] split chunk (cache group: default) > ./a ./index.js 1:0-47 > ./b ./index.js 2:0-47 @@ -3081,7 +3081,7 @@ webpack x.x.x compiled successfully in X ms" exports[`StatsTestCases should print correct stats for side-effects-issue-7428 1`] = ` "asset main.js 12.2 KiB [emitted] (name: main) -asset 1.js 640 bytes [emitted] +asset 1.js 643 bytes [emitted] runtime modules 6.5 KiB 9 modules cacheable modules 823 bytes modules by path ./components/src/ 501 bytes @@ -3267,8 +3267,8 @@ exports[`StatsTestCases should print correct stats for split-chunks 1`] = ` "default: Entrypoint main 11.4 KiB = default/main.js Entrypoint a 12.5 KiB = default/a.js - Entrypoint b 3.93 KiB = default/b.js - Entrypoint c 3.93 KiB = default/c.js + Entrypoint b 3.94 KiB = default/b.js + Entrypoint c 3.94 KiB = default/c.js chunk (runtime: b) default/b.js (b) 196 bytes (javascript) 396 bytes (runtime) [entry] [rendered] > ./b b dependent modules 80 bytes [dependent] 4 modules @@ -3327,8 +3327,8 @@ exports[`StatsTestCases should print correct stats for split-chunks 1`] = ` all-chunks: Entrypoint main 11.4 KiB = all-chunks/main.js Entrypoint a 14.9 KiB = all-chunks/282.js 414 bytes all-chunks/954.js 414 bytes all-chunks/767.js 414 bytes all-chunks/390.js 414 bytes all-chunks/a.js 13.3 KiB - Entrypoint b 8.04 KiB = all-chunks/282.js 414 bytes all-chunks/954.js 414 bytes all-chunks/767.js 414 bytes all-chunks/568.js 414 bytes all-chunks/b.js 6.42 KiB - Entrypoint c 8.04 KiB = all-chunks/282.js 414 bytes all-chunks/769.js 414 bytes all-chunks/767.js 414 bytes all-chunks/568.js 414 bytes all-chunks/c.js 6.42 KiB + Entrypoint b 8.05 KiB = all-chunks/282.js 414 bytes all-chunks/954.js 414 bytes all-chunks/767.js 414 bytes all-chunks/568.js 414 bytes all-chunks/b.js 6.44 KiB + Entrypoint c 8.05 KiB = all-chunks/282.js 414 bytes all-chunks/769.js 414 bytes all-chunks/767.js 414 bytes all-chunks/568.js 414 bytes all-chunks/c.js 6.44 KiB chunk (runtime: b) all-chunks/b.js (b) 116 bytes (javascript) 2.7 KiB (runtime) ={282}= ={568}= ={767}= ={954}= [entry] [rendered] > ./b b runtime modules 2.7 KiB 4 modules @@ -3399,8 +3399,8 @@ all-chunks: manual: Entrypoint main 11.1 KiB = manual/main.js Entrypoint a 14.6 KiB = manual/vendors.js 1.05 KiB manual/a.js 13.6 KiB - Entrypoint b 8.35 KiB = manual/vendors.js 1.05 KiB manual/b.js 7.3 KiB - Entrypoint c 8.35 KiB = manual/vendors.js 1.05 KiB manual/c.js 7.3 KiB + Entrypoint b 8.36 KiB = manual/vendors.js 1.05 KiB manual/b.js 7.32 KiB + Entrypoint c 8.36 KiB = manual/vendors.js 1.05 KiB manual/c.js 7.32 KiB chunk (runtime: b) manual/b.js (b) 156 bytes (javascript) 2.7 KiB (runtime) ={216}= [entry] [rendered] > ./b b > x b @@ -3469,8 +3469,8 @@ manual: name-too-long: Entrypoint main 11.4 KiB = name-too-long/main.js Entrypoint aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 14.9 KiB = name-too-long/282.js 414 bytes name-too-long/954.js 414 bytes name-too-long/767.js 414 bytes name-too-long/390.js 414 bytes name-too-long/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.js 13.3 KiB - Entrypoint bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 8.04 KiB = name-too-long/282.js 414 bytes name-too-long/954.js 414 bytes name-too-long/767.js 414 bytes name-too-long/568.js 414 bytes name-too-long/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.js 6.42 KiB - Entrypoint cccccccccccccccccccccccccccccc 8.04 KiB = name-too-long/282.js 414 bytes name-too-long/769.js 414 bytes name-too-long/767.js 414 bytes name-too-long/568.js 414 bytes name-too-long/cccccccccccccccccccccccccccccc.js 6.42 KiB + Entrypoint bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 8.05 KiB = name-too-long/282.js 414 bytes name-too-long/954.js 414 bytes name-too-long/767.js 414 bytes name-too-long/568.js 414 bytes name-too-long/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.js 6.44 KiB + Entrypoint cccccccccccccccccccccccccccccc 8.05 KiB = name-too-long/282.js 414 bytes name-too-long/769.js 414 bytes name-too-long/767.js 414 bytes name-too-long/568.js 414 bytes name-too-long/cccccccccccccccccccccccccccccc.js 6.44 KiB chunk (runtime: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa, main) name-too-long/async-g.js (async-g) 45 bytes <{282}> <{390}> <{751}> <{767}> <{794}> <{954}> ={568}= [rendered] > ./g ./a.js 6:0-47 ./g.js 45 bytes [built] [code generated] @@ -3541,8 +3541,8 @@ name-too-long: custom-chunks-filter: Entrypoint main 11.4 KiB = custom-chunks-filter/main.js Entrypoint a 12.5 KiB = custom-chunks-filter/a.js - Entrypoint b 8.04 KiB = custom-chunks-filter/282.js 414 bytes custom-chunks-filter/954.js 414 bytes custom-chunks-filter/568.js 414 bytes custom-chunks-filter/767.js 414 bytes custom-chunks-filter/b.js 6.42 KiB - Entrypoint c 8.04 KiB = custom-chunks-filter/282.js 414 bytes custom-chunks-filter/769.js 414 bytes custom-chunks-filter/568.js 414 bytes custom-chunks-filter/767.js 414 bytes custom-chunks-filter/c.js 6.42 KiB + Entrypoint b 8.05 KiB = custom-chunks-filter/282.js 414 bytes custom-chunks-filter/954.js 414 bytes custom-chunks-filter/568.js 414 bytes custom-chunks-filter/767.js 414 bytes custom-chunks-filter/b.js 6.44 KiB + Entrypoint c 8.05 KiB = custom-chunks-filter/282.js 414 bytes custom-chunks-filter/769.js 414 bytes custom-chunks-filter/568.js 414 bytes custom-chunks-filter/767.js 414 bytes custom-chunks-filter/c.js 6.44 KiB chunk (runtime: b) custom-chunks-filter/b.js (b) 116 bytes (javascript) 2.7 KiB (runtime) ={282}= ={568}= ={767}= ={954}= [entry] [rendered] > ./b b runtime modules 2.7 KiB 4 modules @@ -3607,8 +3607,8 @@ custom-chunks-filter: custom-chunks-filter-in-cache-groups: Entrypoint main 11.2 KiB = custom-chunks-filter-in-cache-groups/main.js Entrypoint a 14.5 KiB = custom-chunks-filter-in-cache-groups/176.js 864 bytes custom-chunks-filter-in-cache-groups/a.js 13.6 KiB - Entrypoint b 8.36 KiB = custom-chunks-filter-in-cache-groups/vendors.js 1.05 KiB custom-chunks-filter-in-cache-groups/b.js 7.3 KiB - Entrypoint c 8.36 KiB = custom-chunks-filter-in-cache-groups/vendors.js 1.05 KiB custom-chunks-filter-in-cache-groups/c.js 7.3 KiB + Entrypoint b 8.37 KiB = custom-chunks-filter-in-cache-groups/vendors.js 1.05 KiB custom-chunks-filter-in-cache-groups/b.js 7.32 KiB + Entrypoint c 8.37 KiB = custom-chunks-filter-in-cache-groups/vendors.js 1.05 KiB custom-chunks-filter-in-cache-groups/c.js 7.32 KiB chunk (runtime: b) custom-chunks-filter-in-cache-groups/b.js (b) 156 bytes (javascript) 2.7 KiB (runtime) ={216}= [entry] [rendered] > ./b b > x b @@ -3828,7 +3828,7 @@ default (webpack x.x.x) compiled successfully" exports[`StatsTestCases should print correct stats for split-chunks-issue-7401 1`] = ` "Entrypoint a 6.34 KiB = 282.js 414 bytes a.js 5.93 KiB Entrypoint b 10.8 KiB = b.js -Chunk Group c 794 bytes = 282.js 414 bytes c.js 380 bytes +Chunk Group c 797 bytes = 282.js 414 bytes c.js 383 bytes chunk (runtime: b) b.js (b) 43 bytes (javascript) 6.53 KiB (runtime) >{282}< >{459}< [entry] [rendered] > ./b b runtime modules 6.53 KiB 9 modules From 5ab094a2461133aa184103bba70e0d3c1bf0ffb7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Aug 2021 02:02:32 +0000 Subject: [PATCH 004/151] chore(deps-dev): bump webpack-cli from 4.7.2 to 4.8.0 Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 4.7.2 to 4.8.0. - [Release notes](https://github.com/webpack/webpack-cli/releases) - [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md) - [Commits](https://github.com/webpack/webpack-cli/compare/webpack-cli@4.7.2...webpack-cli@4.8.0) --- updated-dependencies: - dependency-name: webpack-cli dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- yarn.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/yarn.lock b/yarn.lock index 35db81129e9..a7897f08363 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1182,10 +1182,10 @@ dependencies: envinfo "^7.7.3" -"@webpack-cli/serve@^1.5.1": - version "1.5.1" - resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-1.5.1.tgz#b5fde2f0f79c1e120307c415a4c1d5eb15a6f278" - integrity sha512-4vSVUiOPJLmr45S8rMGy7WDvpWxfFxfP/Qx/cxZFCfvoypTYpPPL1X8VIZMe0WTA+Jr7blUxwUSEZNkjoMTgSw== +"@webpack-cli/serve@^1.5.2": + version "1.5.2" + resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-1.5.2.tgz#ea584b637ff63c5a477f6f21604b5a205b72c9ec" + integrity sha512-vgJ5OLWadI8aKjDlOH3rb+dYyPd2GTZuQC/Tihjct6F9GpXGZINo3Y/IVuZVTM1eDQB+/AOsjPUWH/WySDaXvw== "@xtuc/ieee754@^1.2.0": version "1.2.0" @@ -6127,14 +6127,14 @@ webidl-conversions@^6.1.0: integrity sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w== webpack-cli@^4.3.0: - version "4.7.2" - resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-4.7.2.tgz#a718db600de6d3906a4357e059ae584a89f4c1a5" - integrity sha512-mEoLmnmOIZQNiRl0ebnjzQ74Hk0iKS5SiEEnpq3dRezoyR3yPaeQZCMCe+db4524pj1Pd5ghZXjT41KLzIhSLw== + version "4.8.0" + resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-4.8.0.tgz#5fc3c8b9401d3c8a43e2afceacfa8261962338d1" + integrity sha512-+iBSWsX16uVna5aAYN6/wjhJy1q/GKk4KjKvfg90/6hykCTSgozbfz5iRgDTSJt/LgSbYxdBX3KBHeobIs+ZEw== dependencies: "@discoveryjs/json-ext" "^0.5.0" "@webpack-cli/configtest" "^1.0.4" "@webpack-cli/info" "^1.3.0" - "@webpack-cli/serve" "^1.5.1" + "@webpack-cli/serve" "^1.5.2" colorette "^1.2.1" commander "^7.0.0" execa "^5.0.0" From 8e617ed779179aa4788ab0cf3bdf425f24e33b93 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Aug 2021 02:02:58 +0000 Subject: [PATCH 005/151] chore(deps-dev): bump core-js from 3.16.1 to 3.16.2 Bumps [core-js](https://github.com/zloirock/core-js) from 3.16.1 to 3.16.2. - [Release notes](https://github.com/zloirock/core-js/releases) - [Changelog](https://github.com/zloirock/core-js/blob/master/CHANGELOG.md) - [Commits](https://github.com/zloirock/core-js/compare/v3.16.1...v3.16.2) --- updated-dependencies: - dependency-name: core-js dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index e5f8604c7a9..909400daee5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1901,9 +1901,9 @@ copy-anything@^2.0.1: is-what "^3.7.1" core-js@^3.6.5: - version "3.16.1" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.16.1.tgz#f4485ce5c9f3c6a7cb18fa80488e08d362097249" - integrity sha512-AAkP8i35EbefU+JddyWi12AWE9f2N/qr/pwnDtWz4nyUIBGMJPX99ANFFRSw6FefM374lDujdtLDyhN2A/btHw== + version "3.16.2" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.16.2.tgz#3f485822889c7fc48ef463e35be5cc2a4a01a1f4" + integrity sha512-P0KPukO6OjMpjBtHSceAZEWlDD1M2Cpzpg6dBbrjFqFhBHe/BwhxaP820xKOjRn/lZRQirrCusIpLS/n2sgXLQ== core-util-is@1.0.2, core-util-is@^1.0.2, core-util-is@~1.0.0: version "1.0.2" From 2513c65ce45b02e3df7ec9fcc7d861f551746d86 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Aug 2021 02:02:52 +0000 Subject: [PATCH 006/151] chore(deps): bump browserslist from 4.16.7 to 4.16.8 Bumps [browserslist](https://github.com/browserslist/browserslist) from 4.16.7 to 4.16.8. - [Release notes](https://github.com/browserslist/browserslist/releases) - [Changelog](https://github.com/browserslist/browserslist/blob/main/CHANGELOG.md) - [Commits](https://github.com/browserslist/browserslist/compare/4.16.7...4.16.8) --- updated-dependencies: - dependency-name: browserslist dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- yarn.lock | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/yarn.lock b/yarn.lock index e5f8604c7a9..6631d0a2fa7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1570,15 +1570,15 @@ browser-process-hrtime@^1.0.0: integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== browserslist@^4.14.5, browserslist@^4.16.6: - version "4.16.7" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.16.7.tgz#108b0d1ef33c4af1b587c54f390e7041178e4335" - integrity sha512-7I4qVwqZltJ7j37wObBe3SoTz+nS8APaNcrBOlgoirb6/HbEU2XxW/LpUDTCngM6iauwFqmRTuOMfyKnFGY5JA== + version "4.16.8" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.16.8.tgz#cb868b0b554f137ba6e33de0ecff2eda403c4fb0" + integrity sha512-sc2m9ohR/49sWEbPj14ZSSZqp+kbi16aLao42Hmn3Z8FpjuMaq2xCA2l4zl9ITfyzvnvyE0hcg62YkIGKxgaNQ== dependencies: - caniuse-lite "^1.0.30001248" - colorette "^1.2.2" - electron-to-chromium "^1.3.793" + caniuse-lite "^1.0.30001251" + colorette "^1.3.0" + electron-to-chromium "^1.3.811" escalade "^3.1.1" - node-releases "^1.1.73" + node-releases "^1.1.75" bser@2.1.1: version "2.1.1" @@ -1638,10 +1638,10 @@ camelcase@^6.2.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809" integrity sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg== -caniuse-lite@^1.0.30001248: - version "1.0.30001248" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001248.tgz#26ab45e340f155ea5da2920dadb76a533cb8ebce" - integrity sha512-NwlQbJkxUFJ8nMErnGtT0QTM2TJ33xgz4KXJSMIrjXIbDVdaYueGyjOrLKRtJC+rTiWfi6j5cnZN1NBiSBJGNw== +caniuse-lite@^1.0.30001251: + version "1.0.30001251" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001251.tgz#6853a606ec50893115db660f82c094d18f096d85" + integrity sha512-HOe1r+9VkU4TFmnU70z+r7OLmtR+/chB1rdcJUeQlAinjEeb0cKL20tlAtOagNZhbrtLnCvV19B4FmF1rgzl6A== caseless@~0.12.0: version "0.12.0" @@ -1813,10 +1813,10 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -colorette@^1.2.1, colorette@^1.2.2: - version "1.2.2" - resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.2.tgz#cbcc79d5e99caea2dbf10eb3a26fd8b3e6acfa94" - integrity sha512-MKGMzyfeuutC/ZJ1cba9NqcNpfeqMUcYmyF1ZFY6/Cn7CNSAKx6a+s48sqLqyAiZuaP2TcqMhoo+dlwFnVxT9w== +colorette@^1.2.1, colorette@^1.2.2, colorette@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.3.0.tgz#ff45d2f0edb244069d3b772adeb04fed38d0a0af" + integrity sha512-ecORCqbSFP7Wm8Y6lyqMJjexBQqXSF7SSeaTyGGphogUjBlFP9m9o08wy86HL2uB7fMTxtOUzLMk7ogKcxMg1w== combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: version "1.0.8" @@ -2237,10 +2237,10 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" -electron-to-chromium@^1.3.793: - version "1.3.794" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.794.tgz#bccfe7a184ea1cc889dc8cbca3b1e8202b416b8b" - integrity sha512-lN6h2N16+B64/DDNefd2qvehTJl/LDZ/ORXKL2JHaLGhVxjj7ybuA/oVprKtTNvmOTgzUrpP02HhgoS27E2rGA== +electron-to-chromium@^1.3.811: + version "1.3.812" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.812.tgz#4c4fb407e0e1335056097f172e9f2c0a09efe77d" + integrity sha512-7KiUHsKAWtSrjVoTSzxQ0nPLr/a+qoxNZwkwd9LkylTOgOXSVXkQbpIVT0WAUQcI5gXq3SwOTCrK+WfINHOXQg== emittery@^0.8.1: version "0.8.1" @@ -4487,10 +4487,10 @@ node-preload@^0.2.1: dependencies: process-on-spawn "^1.0.0" -node-releases@^1.1.73: - version "1.1.73" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.73.tgz#dd4e81ddd5277ff846b80b52bb40c49edf7a7b20" - integrity sha512-uW7fodD6pyW2FZNZnp/Z3hvWKeEW1Y8R1+1CnErE8cXFXzl5blBOoVB41CvMer6P6Q0S5FXDwcHgFd1Wj0U9zg== +node-releases@^1.1.75: + version "1.1.75" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.75.tgz#6dd8c876b9897a1b8e5a02de26afa79bb54ebbfe" + integrity sha512-Qe5OUajvqrqDSy6wrWFmMwfJ0jVgwiw4T3KqmbTcZ62qW0gQkheXYhcFM1+lOVcGUoRxcEcfyvFMAnDgaF1VWw== nopt@3.x: version "3.0.6" From d28592e9daf1f483c621708451534fc1ec7240c6 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Fri, 20 Aug 2021 08:12:50 +0200 Subject: [PATCH 007/151] update examples --- examples/aggressive-merging/README.md | 34 +- examples/asset-advanced/README.md | 98 ++-- examples/asset-simple/README.md | 104 ++-- examples/build-http/README.md | 6 +- examples/chunkhash/README.md | 164 +++--- examples/cjs-tree-shaking/README.md | 27 +- .../README.md | 64 +- .../code-splitted-require.context/README.md | 64 +- .../code-splitting-bundle-loader/README.md | 67 +-- .../README.md | 242 ++++---- .../code-splitting-depend-on-simple/README.md | 185 +++--- examples/code-splitting-harmony/README.md | 156 +++-- .../README.md | 91 ++- .../README.md | 91 ++- .../README.md | 83 ++- examples/code-splitting/README.md | 65 +-- examples/coffee-script/README.md | 15 +- .../common-chunk-and-vendor-chunk/README.md | 409 +++++++------ examples/common-chunk-grandchildren/README.md | 66 +-- examples/commonjs/README.md | 15 +- examples/custom-json-modules/README.md | 74 ++- .../dll-app-and-vendor/0-vendor/README.md | 36 +- examples/dll-app-and-vendor/1-app/README.md | 64 +- examples/dll-entry-only/README.md | 164 +++--- examples/dll-user/README.md | 100 ++-- examples/dll/README.md | 81 ++- examples/explicit-vendor-chunk/README.md | 57 +- examples/externals/README.md | 52 +- examples/extra-async-chunk-advanced/README.md | 66 +-- examples/extra-async-chunk/README.md | 66 +-- examples/harmony-interop/README.md | 106 ++-- examples/harmony-library/README.md | 100 ++-- examples/harmony-unused/README.md | 92 ++- examples/harmony/README.md | 112 ++-- examples/http2-aggressive-splitting/README.md | 32 +- examples/hybrid-routing/README.md | 203 ++++--- examples/loader/README.md | 131 +++-- examples/many-pages/README.md | 44 +- examples/mixed/README.md | 73 ++- examples/module-code-splitting/README.md | 63 +- examples/module-federation/README.md | 551 +++++++++--------- examples/module-library/README.md | 7 +- examples/module-worker/README.md | 176 +++--- examples/module/README.md | 7 +- examples/multi-compiler/README.md | 22 +- examples/multi-part-library/README.md | 142 +++-- examples/multiple-entry-points/README.md | 302 +++++----- examples/named-chunks/README.md | 65 +-- examples/persistent-caching/README.md | 20 +- examples/reexport-components/README.md | 62 +- examples/require.context/README.md | 25 +- examples/require.resolve/README.md | 19 +- examples/scope-hoisting/README.md | 77 ++- examples/side-effects/README.md | 90 ++- examples/source-map/README.md | 200 ++++--- examples/top-level-await/README.md | 219 ++++--- examples/two-explicit-vendor-chunks/README.md | 57 +- examples/typescript/README.md | 37 +- examples/wasm-complex/README.md | 183 ++++-- examples/wasm-simple/README.md | 171 ++++-- examples/worker/README.md | 26 +- 61 files changed, 3213 insertions(+), 3007 deletions(-) diff --git a/examples/aggressive-merging/README.md b/examples/aggressive-merging/README.md index 1b3e91e4731..39b58bf00e2 100644 --- a/examples/aggressive-merging/README.md +++ b/examples/aggressive-merging/README.md @@ -65,15 +65,15 @@ asset pageB.bundle.js 8.91 KiB [emitted] (name: pageB) asset pageC.bundle.js 8.91 KiB [emitted] (name: pageC) asset 456.chunk.js 6.28 KiB [emitted] asset 394.chunk.js 606 bytes [emitted] -chunk (runtime: pageB) pageB.bundle.js (pageB) 69 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered] +chunk (runtime: pageB) pageB.bundle.js (pageB) 69 bytes (javascript) 4.98 KiB (runtime) [entry] [rendered] > ./pageB pageB - runtime modules 4.97 KiB 6 modules + runtime modules 4.98 KiB 6 modules ./pageB.js 69 bytes [built] [code generated] [used exports unknown] entry ./pageB pageB -chunk (runtime: pageC) pageC.bundle.js (pageC) 68 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered] +chunk (runtime: pageC) pageC.bundle.js (pageC) 68 bytes (javascript) 4.98 KiB (runtime) [entry] [rendered] > ./pageC pageC - runtime modules 4.97 KiB 6 modules + runtime modules 4.98 KiB 6 modules ./pageC.js 68 bytes [built] [code generated] [used exports unknown] entry ./pageC pageC @@ -89,9 +89,9 @@ chunk (runtime: pageC) 394.chunk.js 42 bytes [rendered] cjs self exports reference ./b.js 1:0-14 cjs require ./b ./pageB.js 2:8-22 cjs require ./b ./pageC.js 2:17-31 -chunk (runtime: pageA) pageA.bundle.js (pageA) 69 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered] +chunk (runtime: pageA) pageA.bundle.js (pageA) 69 bytes (javascript) 4.98 KiB (runtime) [entry] [rendered] > ./pageA pageA - runtime modules 4.97 KiB 6 modules + runtime modules 4.98 KiB 6 modules ./pageA.js 69 bytes [built] [code generated] [used exports unknown] entry ./pageA pageA @@ -113,26 +113,26 @@ chunk (runtime: pageA, pageB) 456.chunk.js 5.45 KiB [rendered] cjs self exports reference ./common.js 1:0-14 amd require ./common ./pageA.js 1:0-3:2 amd require ./common ./pageB.js 1:0-3:2 -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` ## Production mode ``` -asset pageC.bundle.js 1.73 KiB [emitted] [minimized] (name: pageC) -asset pageA.bundle.js 1.72 KiB [emitted] [minimized] (name: pageA) -asset pageB.bundle.js 1.72 KiB [emitted] [minimized] (name: pageB) +asset pageC.bundle.js 1.74 KiB [emitted] [minimized] (name: pageC) +asset pageA.bundle.js 1.73 KiB [emitted] [minimized] (name: pageA) +asset pageB.bundle.js 1.73 KiB [emitted] [minimized] (name: pageB) asset 456.chunk.js 155 bytes [emitted] [minimized] asset 394.chunk.js 104 bytes [emitted] [minimized] -chunk (runtime: pageB) pageB.bundle.js (pageB) 69 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered] +chunk (runtime: pageB) pageB.bundle.js (pageB) 69 bytes (javascript) 4.98 KiB (runtime) [entry] [rendered] > ./pageB pageB - runtime modules 4.97 KiB 6 modules + runtime modules 4.98 KiB 6 modules ./pageB.js 69 bytes [built] [code generated] [no exports used] entry ./pageB pageB -chunk (runtime: pageC) pageC.bundle.js (pageC) 68 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered] +chunk (runtime: pageC) pageC.bundle.js (pageC) 68 bytes (javascript) 4.98 KiB (runtime) [entry] [rendered] > ./pageC pageC - runtime modules 4.97 KiB 6 modules + runtime modules 4.98 KiB 6 modules ./pageC.js 68 bytes [built] [code generated] [no exports used] entry ./pageC pageC @@ -148,9 +148,9 @@ chunk (runtime: pageC) 394.chunk.js 42 bytes [rendered] cjs self exports reference ./b.js 1:0-14 cjs require ./b ./pageB.js 2:8-22 cjs require ./b ./pageC.js 2:17-31 -chunk (runtime: pageA) pageA.bundle.js (pageA) 69 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered] +chunk (runtime: pageA) pageA.bundle.js (pageA) 69 bytes (javascript) 4.98 KiB (runtime) [entry] [rendered] > ./pageA pageA - runtime modules 4.97 KiB 6 modules + runtime modules 4.98 KiB 6 modules ./pageA.js 69 bytes [built] [code generated] [no exports used] entry ./pageA pageA @@ -172,5 +172,5 @@ chunk (runtime: pageA, pageB) 456.chunk.js 5.45 KiB [rendered] cjs self exports reference ./common.js 1:0-14 amd require ./common ./pageA.js 1:0-3:2 amd require ./common ./pageB.js 1:0-3:2 -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` diff --git a/examples/asset-advanced/README.md b/examples/asset-advanced/README.md index 73e519639c2..78756932738 100644 --- a/examples/asset-advanced/README.md +++ b/examples/asset-advanced/README.md @@ -74,48 +74,7 @@ module.exports = { /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ([ -/* 0 */ -/*!********************!*\ - !*** ./example.js ***! - \********************/ -/*! namespace exports */ -/*! exports [not provided] [no usage info] */ -/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _images_file_svg__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./images/file.svg */ 1); - - -const container = document.createElement("div"); -Object.assign(container.style, { - display: "flex", - justifyContent: "center" -}); -document.body.appendChild(container); - -function createImageElement(title, src) { - const div = document.createElement("div"); - div.style.textAlign = "center"; - - const h2 = document.createElement("h2"); - h2.textContent = title; - div.appendChild(h2); - - const img = document.createElement("img"); - img.setAttribute("src", src); - img.setAttribute("width", "150"); - div.appendChild(img); - - container.appendChild(div); -} - -[_images_file_svg__WEBPACK_IMPORTED_MODULE_0__].forEach(src => { - createImageElement(src.split(".").pop(), src); -}); - - -/***/ }), +/* 0 */, /* 1 */ /*!*************************!*\ !*** ./images/file.svg ***! @@ -141,8 +100,9 @@ module.exports = "data:image/svg+xml,%3csvg xmlns='http://www.w3.or...3c/svg%3e" /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -176,10 +136,48 @@ module.exports = "data:image/svg+xml,%3csvg xmlns='http://www.w3.or...3c/svg%3e" ``` js -/******/ // startup -/******/ // Load entry module -/******/ __webpack_require__(0); -/******/ // This entry module used 'exports' so it can't be inlined +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { +/*!********************!*\ + !*** ./example.js ***! + \********************/ +/*! namespace exports */ +/*! exports [not provided] [no usage info] */ +/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */ +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _images_file_svg__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./images/file.svg */ 1); + + +const container = document.createElement("div"); +Object.assign(container.style, { + display: "flex", + justifyContent: "center" +}); +document.body.appendChild(container); + +function createImageElement(title, src) { + const div = document.createElement("div"); + div.style.textAlign = "center"; + + const h2 = document.createElement("h2"); + h2.textContent = title; + div.appendChild(h2); + + const img = document.createElement("img"); + img.setAttribute("src", src); + img.setAttribute("width", "150"); + div.appendChild(img); + + container.appendChild(div); +} + +[_images_file_svg__WEBPACK_IMPORTED_MODULE_0__].forEach(src => { + createImageElement(src.split(".").pop(), src); +}); + +})(); + /******/ })() ; ``` @@ -189,7 +187,7 @@ module.exports = "data:image/svg+xml,%3csvg xmlns='http://www.w3.or...3c/svg%3e" ## webpack output ``` -asset output.js 3.86 KiB [emitted] (name: main) +asset output.js 3.81 KiB [emitted] (name: main) chunk (runtime: main) output.js (main) 1.54 KiB (javascript) 274 bytes (runtime) [entry] [rendered] > ./example.js main dependent modules 915 bytes [dependent] 1 module @@ -198,5 +196,5 @@ chunk (runtime: main) output.js (main) 1.54 KiB (javascript) 274 bytes (runtime) [no exports] [used exports unknown] entry ./example.js main -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` diff --git a/examples/asset-simple/README.md b/examples/asset-simple/README.md index 0841a580c8e..29a868a6bf6 100644 --- a/examples/asset-simple/README.md +++ b/examples/asset-simple/README.md @@ -61,52 +61,7 @@ module.exports = { /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ([ -/* 0 */ -/*!********************!*\ - !*** ./example.js ***! - \********************/ -/*! namespace exports */ -/*! exports [not provided] [no usage info] */ -/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _images_file_png__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./images/file.png */ 1); -/* harmony import */ var _images_file_jpg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./images/file.jpg */ 2); -/* harmony import */ var _images_file_svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./images/file.svg */ 3); - - - - -const container = document.createElement("div"); -Object.assign(container.style, { - display: "flex", - justifyContent: "center" -}); -document.body.appendChild(container); - -function createImageElement(title, src) { - const div = document.createElement("div"); - div.style.textAlign = "center"; - - const h2 = document.createElement("h2"); - h2.textContent = title; - div.appendChild(h2); - - const img = document.createElement("img"); - img.setAttribute("src", src); - img.setAttribute("width", "150"); - div.appendChild(img); - - container.appendChild(div); -} - -[_images_file_png__WEBPACK_IMPORTED_MODULE_0__, _images_file_jpg__WEBPACK_IMPORTED_MODULE_1__, _images_file_svg__WEBPACK_IMPORTED_MODULE_2__].forEach(src => { - createImageElement(src.split(".").pop(), src); -}); - - -/***/ }), +/* 0 */, /* 1 */ /*!*************************!*\ !*** ./images/file.png ***! @@ -156,8 +111,9 @@ module.exports = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDo...vc3ZnPgo=" /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -196,10 +152,52 @@ module.exports = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDo...vc3ZnPgo=" ``` js -/******/ // startup -/******/ // Load entry module -/******/ __webpack_require__(0); -/******/ // This entry module used 'exports' so it can't be inlined +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { +/*!********************!*\ + !*** ./example.js ***! + \********************/ +/*! namespace exports */ +/*! exports [not provided] [no usage info] */ +/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */ +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _images_file_png__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./images/file.png */ 1); +/* harmony import */ var _images_file_jpg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./images/file.jpg */ 2); +/* harmony import */ var _images_file_svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./images/file.svg */ 3); + + + + +const container = document.createElement("div"); +Object.assign(container.style, { + display: "flex", + justifyContent: "center" +}); +document.body.appendChild(container); + +function createImageElement(title, src) { + const div = document.createElement("div"); + div.style.textAlign = "center"; + + const h2 = document.createElement("h2"); + h2.textContent = title; + div.appendChild(h2); + + const img = document.createElement("img"); + img.setAttribute("src", src); + img.setAttribute("width", "150"); + div.appendChild(img); + + container.appendChild(div); +} + +[_images_file_png__WEBPACK_IMPORTED_MODULE_0__, _images_file_jpg__WEBPACK_IMPORTED_MODULE_1__, _images_file_svg__WEBPACK_IMPORTED_MODULE_2__].forEach(src => { + createImageElement(src.split(".").pop(), src); +}); + +})(); + /******/ })() ; ``` @@ -219,5 +217,5 @@ chunk (runtime: main) output.js (main) 9.58 KiB (javascript) 14.6 KiB (asset) 30 [no exports] [used exports unknown] entry ./example.js main -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` diff --git a/examples/build-http/README.md b/examples/build-http/README.md index 9e53baf8e3b..9eed549a2a4 100644 --- a/examples/build-http/README.md +++ b/examples/build-http/README.md @@ -30,7 +30,7 @@ module.exports = { ## Unoptimized ``` -asset output.js 61.7 KiB [emitted] (name: main) +asset output.js 61.9 KiB [emitted] (name: main) runtime modules 670 bytes 3 modules modules by path https:// 21.9 KiB modules by path https://jspm.dev/ 8.43 KiB @@ -62,7 +62,7 @@ modules by path https:// 21.9 KiB [no exports] [used exports unknown] entry ./example.js main -webpack 5.48.0 compiled successfully +webpack 5.51.1 compiled successfully ``` ## Production mode @@ -74,5 +74,5 @@ orphan modules 21.9 KiB [orphan] 25 modules [no exports] [no exports used] entry ./example.js main -webpack 5.48.0 compiled successfully +webpack 5.51.1 compiled successfully ``` diff --git a/examples/chunkhash/README.md b/examples/chunkhash/README.md index a18d19a83df..3527107f0d5 100644 --- a/examples/chunkhash/README.md +++ b/examples/chunkhash/README.md @@ -43,7 +43,7 @@ module.exports = { @@ -69,8 +69,9 @@ module.exports = { /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -89,13 +90,42 @@ module.exports = { /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = __webpack_modules__; /******/ -/******/ // the startup function -/******/ // It's empty as some runtime module handles the default behavior -/******/ __webpack_require__.x = x => {} /************************************************************************/ +/******/ /* webpack/runtime/chunk loaded */ +/******/ (() => { +/******/ var deferred = []; +/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => { +/******/ if(chunkIds) { +/******/ priority = priority || 0; +/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; +/******/ deferred[i] = [chunkIds, fn, priority]; +/******/ return; +/******/ } +/******/ var notFulfilled = Infinity; +/******/ for (var i = 0; i < deferred.length; i++) { +/******/ var [chunkIds, fn, priority] = deferred[i]; +/******/ var fulfilled = true; +/******/ for (var j = 0; j < chunkIds.length; j++) { +/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) { +/******/ chunkIds.splice(j--, 1); +/******/ } else { +/******/ fulfilled = false; +/******/ if(priority < notFulfilled) notFulfilled = priority; +/******/ } +/******/ } +/******/ if(fulfilled) { +/******/ deferred.splice(i--, 1) +/******/ var r = fn(); +/******/ if (r !== undefined) result = r; +/******/ } +/******/ } +/******/ return result; +/******/ }; +/******/ })(); +/******/ /******/ /* webpack/runtime/create fake namespace object */ /******/ (() => { -/******/ var getProto = Object.getPrototypeOf ? (obj) => Object.getPrototypeOf(obj) : (obj) => obj.__proto__; +/******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__); /******/ var leafPrototypes; /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it @@ -115,9 +145,9 @@ module.exports = { /******/ var def = {}; /******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)]; /******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) { -/******/ Object.getOwnPropertyNames(current).forEach(key => def[key] = () => value[key]); +/******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key]))); /******/ } -/******/ def['default'] = () => value; +/******/ def['default'] = () => (value); /******/ __webpack_require__.d(ns, def); /******/ return ns; /******/ }; @@ -159,7 +189,7 @@ module.exports = { /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop) +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/load script */ @@ -167,7 +197,7 @@ module.exports = { /******/ var inProgress = {}; /******/ // data-webpack is not used as build has no uniqueName /******/ // loadScript function to load a script via script tag -/******/ __webpack_require__.l = (url, done, key) => { +/******/ __webpack_require__.l = (url, done, key, chunkId) => { /******/ if(inProgress[url]) { inProgress[url].push(done); return; } /******/ var script, needAttach; /******/ if(key !== undefined) { @@ -197,7 +227,7 @@ module.exports = { /******/ var doneFns = inProgress[url]; /******/ delete inProgress[url]; /******/ script.parentNode && script.parentNode.removeChild(script); -/******/ doneFns && doneFns.forEach((fn) => fn(event)); +/******/ doneFns && doneFns.forEach((fn) => (fn(event))); /******/ if(prev) return prev(event); /******/ } /******/ ; @@ -230,14 +260,11 @@ module.exports = { /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched -/******/ // Promise = chunk loading, 0 = chunk loaded +/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 1: 0 /******/ }; /******/ -/******/ var deferredModules = [ -/******/ -/******/ ]; /******/ __webpack_require__.f.j = (chunkId, promises) => { /******/ // JSONP chunk loading for javascript /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined; @@ -247,11 +274,9 @@ module.exports = { /******/ if(installedChunkData) { /******/ promises.push(installedChunkData[2]); /******/ } else { -/******/ if(true) { // all chunks have JS +/******/ if(1 != chunkId) { /******/ // setup Promise in chunk cache -/******/ var promise = new Promise((resolve, reject) => { -/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; -/******/ }); +/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject])); /******/ promises.push(installedChunkData[2] = promise); /******/ /******/ // start chunk loading @@ -273,7 +298,7 @@ module.exports = { /******/ } /******/ } /******/ }; -/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId); +/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId); /******/ } else installedChunks[chunkId] = 0; /******/ } /******/ } @@ -287,69 +312,36 @@ module.exports = { /******/ /******/ // no HMR manifest /******/ -/******/ var checkDeferredModules = x => {}; +/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0); /******/ /******/ // install a JSONP callback for chunk loading /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { -/******/ var [chunkIds, moreModules, runtime, executeModules] = data; +/******/ var [chunkIds, moreModules, runtime] = data; /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, resolves = []; +/******/ var moduleId, chunkId, i = 0; +/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { +/******/ for(moduleId in moreModules) { +/******/ if(__webpack_require__.o(moreModules, moduleId)) { +/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(runtime) var result = runtime(__webpack_require__); +/******/ } +/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); /******/ for(;i < chunkIds.length; i++) { /******/ chunkId = chunkIds[i]; /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { -/******/ resolves.push(installedChunks[chunkId][0]); +/******/ installedChunks[chunkId][0](); /******/ } -/******/ installedChunks[chunkId] = 0; +/******/ installedChunks[chunkIds[i]] = 0; /******/ } -/******/ for(moduleId in moreModules) { -/******/ if(__webpack_require__.o(moreModules, moduleId)) { -/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; -/******/ } -/******/ } -/******/ if(runtime) runtime(__webpack_require__); -/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); -/******/ while(resolves.length) { -/******/ resolves.shift()(); -/******/ } -/******/ -/******/ // add entry modules from loaded chunk to deferred list -/******/ if(executeModules) deferredModules.push.apply(deferredModules, executeModules); -/******/ -/******/ // run deferred modules when all chunks ready -/******/ return checkDeferredModules(); +/******/ return __webpack_require__.O(result); /******/ } /******/ /******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || []; /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); -/******/ -/******/ function checkDeferredModulesImpl() { -/******/ var result; -/******/ for(var i = 0; i < deferredModules.length; i++) { -/******/ var deferredModule = deferredModules[i]; -/******/ var fulfilled = true; -/******/ for(var j = 1; j < deferredModule.length; j++) { -/******/ var depId = deferredModule[j]; -/******/ if(installedChunks[depId] !== 0) fulfilled = false; -/******/ } -/******/ if(fulfilled) { -/******/ deferredModules.splice(i--, 1); -/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]); -/******/ } -/******/ } -/******/ if(deferredModules.length === 0) { -/******/ __webpack_require__.x(); -/******/ __webpack_require__.x = x => {}; -/******/ } -/******/ return result; -/******/ } -/******/ var startup = __webpack_require__.x; -/******/ __webpack_require__.x = () => { -/******/ // reset startup function so it can be called again when more startup code is added -/******/ __webpack_require__.x = startup || (x => {}); -/******/ return (checkDeferredModules = checkDeferredModulesImpl)(); -/******/ }; /******/ })(); /******/ /************************************************************************/ @@ -358,8 +350,8 @@ module.exports = { ``` js -/******/ // run startup -/******/ return __webpack_require__.x(); +/******/ +/******/ /******/ })() ; ``` @@ -383,7 +375,11 @@ __webpack_require__.e(/*! import() */ 3).then(__webpack_require__.t.bind(__webpa /***/ }) ], -0,[[0,1]]]); +/******/ __webpack_require__ => { // webpackRuntimeModules +/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId)) +/******/ var __webpack_exports__ = (__webpack_exec__(0)); +/******/ } +]); ``` # Info @@ -391,19 +387,19 @@ __webpack_require__.e(/*! import() */ 3).then(__webpack_require__.t.bind(__webpa ## Unoptimized ``` -asset runtime~main.[chunkhash].js 12.5 KiB [emitted] (name: runtime~main) -asset main.[chunkhash].js 652 bytes [emitted] (name: main) +asset runtime~main.[chunkhash].js 12.2 KiB [emitted] (name: runtime~main) +asset main.[chunkhash].js 873 bytes [emitted] (name: main) asset 2.[chunkhash].js 285 bytes [emitted] asset 3.[chunkhash].js 279 bytes [emitted] -Entrypoint main 13.1 KiB = runtime~main.[chunkhash].js 12.5 KiB main.[chunkhash].js 652 bytes +Entrypoint main 13 KiB = runtime~main.[chunkhash].js 12.2 KiB main.[chunkhash].js 873 bytes chunk (runtime: runtime~main) main.[chunkhash].js (main) 55 bytes [initial] [rendered] > ./example main ./example.js 55 bytes [built] [code generated] [used exports unknown] entry ./example main -chunk (runtime: runtime~main) runtime~main.[chunkhash].js (runtime~main) 7.7 KiB [entry] [rendered] +chunk (runtime: runtime~main) runtime~main.[chunkhash].js (runtime~main) 7.6 KiB [entry] [rendered] > ./example main - runtime modules 7.7 KiB 9 modules + runtime modules 7.6 KiB 10 modules chunk (runtime: runtime~main) 2.[chunkhash].js 28 bytes [rendered] > ./async1 ./example.js 2:0-18 ./async1.js 28 bytes [built] [code generated] @@ -414,17 +410,17 @@ chunk (runtime: runtime~main) 3.[chunkhash].js 28 bytes [rendered] ./async2.js 28 bytes [built] [code generated] [used exports unknown] import() ./async2 ./example.js 3:0-18 -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` ## Production mode ``` -asset runtime~main.[chunkhash].js 2.63 KiB [emitted] [minimized] (name: runtime~main) -asset main.[chunkhash].js 155 bytes [emitted] [minimized] (name: main) +asset runtime~main.[chunkhash].js 2.73 KiB [emitted] [minimized] (name: runtime~main) +asset main.[chunkhash].js 157 bytes [emitted] [minimized] (name: main) asset 114.[chunkhash].js 69 bytes [emitted] [minimized] asset 172.[chunkhash].js 69 bytes [emitted] [minimized] -Entrypoint main 2.78 KiB = runtime~main.[chunkhash].js 2.63 KiB main.[chunkhash].js 155 bytes +Entrypoint main 2.89 KiB = runtime~main.[chunkhash].js 2.73 KiB main.[chunkhash].js 157 bytes chunk (runtime: runtime~main) 114.[chunkhash].js 28 bytes [rendered] > ./async1 ./example.js 2:0-18 ./async1.js 28 bytes [built] [code generated] @@ -440,8 +436,8 @@ chunk (runtime: runtime~main) main.[chunkhash].js (main) 55 bytes [initial] [ren ./example.js 55 bytes [built] [code generated] [no exports used] entry ./example main -chunk (runtime: runtime~main) runtime~main.[chunkhash].js (runtime~main) 7.7 KiB [entry] [rendered] +chunk (runtime: runtime~main) runtime~main.[chunkhash].js (runtime~main) 7.6 KiB [entry] [rendered] > ./example main - runtime modules 7.7 KiB 9 modules -webpack 5.11.1 compiled successfully + runtime modules 7.6 KiB 10 modules +webpack 5.51.1 compiled successfully ``` diff --git a/examples/cjs-tree-shaking/README.md b/examples/cjs-tree-shaking/README.md index 99aac42c798..1a67c5a0604 100644 --- a/examples/cjs-tree-shaking/README.md +++ b/examples/cjs-tree-shaking/README.md @@ -126,8 +126,9 @@ __webpack_unused_export__ = function multiply() { /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -149,6 +150,8 @@ __webpack_unused_export__ = function multiply() { ``` js +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { /*!********************!*\ !*** ./example.js ***! @@ -169,14 +172,14 @@ inc(a); // 2 ```javascript /*! For license information please see output.js.LICENSE.txt */ -(()=>{var r=[,(r,n,t)=>{const e=t(2).I;n.nP=function(r){return e(r,1)}},(r,n)=>{n.I=function(){for(var r=0,n=0,t=arguments,e=t.length;n{var r=[,(r,n,t)=>{const o=t(2).I;n.nP=function(r){return o(r,1)}},(r,n)=>{n.I=function(){for(var r=0,n=0,t=arguments,o=t.length;n{var n=[,(n,r,t)=>{const e=t(2).add;r.increment=function(n){return e(n,1)},r.incrementBy2=function(n){return e(n,2)},r.decrement=function(n){return e(n,1)}},(n,r)=>{r.add=function(){for(var n=0,r=0,t=arguments,e=t.length;r{var n=[,(n,r,t)=>{const e=t(2).add;r.increment=function(n){return e(n,1)},r.incrementBy2=function(n){return e(n,2)},r.decrement=function(n){return e(n,1)}},(n,r)=>{r.add=function(){for(var n=0,r=0,t=arguments,e=t.length;r ./example.js main dependent modules 564 bytes [dependent] 2 modules ./example.js 70 bytes [built] [code generated] [no exports used] entry ./example.js main -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully -asset without.js 2.91 KiB [emitted] (name: main) +asset without.js 3.08 KiB [emitted] (name: main) chunk (runtime: main) without.js (main) 634 bytes [entry] [rendered] > ./example.js main dependent modules 564 bytes [dependent] 2 modules ./example.js 70 bytes [built] [code generated] [used exports unknown] entry ./example.js main -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` ## Production mode ``` -asset output.js 351 bytes [emitted] [minimized] (name: main) 1 related asset +asset output.js 365 bytes [emitted] [minimized] (name: main) 1 related asset chunk (runtime: main) output.js (main) 634 bytes [entry] [rendered] > ./example.js main dependent modules 564 bytes [dependent] 2 modules ./example.js 70 bytes [built] [code generated] [no exports used] entry ./example.js main -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully -asset without.js 537 bytes [emitted] [minimized] (name: main) 1 related asset +asset without.js 551 bytes [emitted] [minimized] (name: main) 1 related asset chunk (runtime: main) without.js (main) 634 bytes [entry] [rendered] > ./example.js main dependent modules 564 bytes [dependent] 2 modules ./example.js 70 bytes [built] [code generated] [used exports unknown] entry ./example.js main -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` diff --git a/examples/code-splitted-require.context-amd/README.md b/examples/code-splitted-require.context-amd/README.md index 0645f2375a2..8c3c8b6e2f1 100644 --- a/examples/code-splitted-require.context-amd/README.md +++ b/examples/code-splitted-require.context-amd/README.md @@ -31,8 +31,9 @@ getTemplate("b", function(b) { /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -76,7 +77,7 @@ getTemplate("b", function(b) { /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop) +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/load script */ @@ -84,7 +85,7 @@ getTemplate("b", function(b) { /******/ var inProgress = {}; /******/ // data-webpack is not used as build has no uniqueName /******/ // loadScript function to load a script via script tag -/******/ __webpack_require__.l = (url, done, key) => { +/******/ __webpack_require__.l = (url, done, key, chunkId) => { /******/ if(inProgress[url]) { inProgress[url].push(done); return; } /******/ var script, needAttach; /******/ if(key !== undefined) { @@ -114,7 +115,7 @@ getTemplate("b", function(b) { /******/ var doneFns = inProgress[url]; /******/ delete inProgress[url]; /******/ script.parentNode && script.parentNode.removeChild(script); -/******/ doneFns && doneFns.forEach((fn) => fn(event)); +/******/ doneFns && doneFns.forEach((fn) => (fn(event))); /******/ if(prev) return prev(event); /******/ } /******/ ; @@ -136,12 +137,11 @@ getTemplate("b", function(b) { /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched -/******/ // Promise = chunk loading, 0 = chunk loaded +/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 179: 0 /******/ }; /******/ -/******/ /******/ __webpack_require__.f.j = (chunkId, promises) => { /******/ // JSONP chunk loading for javascript /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined; @@ -153,9 +153,7 @@ getTemplate("b", function(b) { /******/ } else { /******/ if(true) { // all chunks have JS /******/ // setup Promise in chunk cache -/******/ var promise = new Promise((resolve, reject) => { -/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; -/******/ }); +/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject])); /******/ promises.push(installedChunkData[2] = promise); /******/ /******/ // start chunk loading @@ -177,7 +175,7 @@ getTemplate("b", function(b) { /******/ } /******/ } /******/ }; -/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId); +/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId); /******/ } else installedChunks[chunkId] = 0; /******/ } /******/ } @@ -191,30 +189,29 @@ getTemplate("b", function(b) { /******/ /******/ // no HMR manifest /******/ -/******/ // no deferred startup +/******/ // no on chunks loaded /******/ /******/ // install a JSONP callback for chunk loading /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { /******/ var [chunkIds, moreModules, runtime] = data; /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, resolves = []; +/******/ var moduleId, chunkId, i = 0; +/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { +/******/ for(moduleId in moreModules) { +/******/ if(__webpack_require__.o(moreModules, moduleId)) { +/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(runtime) var result = runtime(__webpack_require__); +/******/ } +/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); /******/ for(;i < chunkIds.length; i++) { /******/ chunkId = chunkIds[i]; /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { -/******/ resolves.push(installedChunks[chunkId][0]); +/******/ installedChunks[chunkId][0](); /******/ } -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ for(moduleId in moreModules) { -/******/ if(__webpack_require__.o(moreModules, moduleId)) { -/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; -/******/ } -/******/ } -/******/ if(runtime) runtime(__webpack_require__); -/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); -/******/ while(resolves.length) { -/******/ resolves.shift()(); +/******/ installedChunks[chunkIds[i]] = 0; /******/ } /******/ /******/ } @@ -222,8 +219,6 @@ getTemplate("b", function(b) { /******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || []; /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); -/******/ -/******/ // no deferred startup /******/ })(); /******/ /************************************************************************/ @@ -232,6 +227,7 @@ getTemplate("b", function(b) { ``` js +var __webpack_exports__ = {}; /*!********************!*\ !*** ./example.js ***! \********************/ @@ -346,11 +342,11 @@ module.exports = function() { ## Unoptimized ``` -asset output.js 9.04 KiB [emitted] (name: main) +asset output.js 9.05 KiB [emitted] (name: main) asset 577.output.js 2.23 KiB [emitted] -chunk (runtime: main) output.js (main) 251 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 251 bytes (javascript) 4.98 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 4.97 KiB 6 modules + runtime modules 4.98 KiB 6 modules ./example.js 251 bytes [built] [code generated] [used exports unknown] entry ./example.js main @@ -361,7 +357,7 @@ chunk (runtime: main) 577.output.js 457 bytes [rendered] [no exports] [used exports unknown] amd require context ./example.js 2:1-4:3 -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` ## Production mode @@ -369,9 +365,9 @@ webpack 5.11.1 compiled successfully ``` asset output.js 1.82 KiB [emitted] [minimized] (name: main) asset 577.output.js 609 bytes [emitted] [minimized] -chunk (runtime: main) output.js (main) 251 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 251 bytes (javascript) 4.98 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 4.97 KiB 6 modules + runtime modules 4.98 KiB 6 modules ./example.js 251 bytes [built] [code generated] [no exports used] entry ./example.js main @@ -381,5 +377,5 @@ chunk (runtime: main) 577.output.js 457 bytes [rendered] ../require.context/templates/ sync ^\.\/.*$ 217 bytes [built] [code generated] [no exports] amd require context ./example.js 2:1-4:3 -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` diff --git a/examples/code-splitted-require.context/README.md b/examples/code-splitted-require.context/README.md index 1073a2b087d..400ad77b9d4 100644 --- a/examples/code-splitted-require.context/README.md +++ b/examples/code-splitted-require.context/README.md @@ -31,8 +31,9 @@ getTemplate("b", function(b) { /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -76,7 +77,7 @@ getTemplate("b", function(b) { /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop) +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/load script */ @@ -84,7 +85,7 @@ getTemplate("b", function(b) { /******/ var inProgress = {}; /******/ // data-webpack is not used as build has no uniqueName /******/ // loadScript function to load a script via script tag -/******/ __webpack_require__.l = (url, done, key) => { +/******/ __webpack_require__.l = (url, done, key, chunkId) => { /******/ if(inProgress[url]) { inProgress[url].push(done); return; } /******/ var script, needAttach; /******/ if(key !== undefined) { @@ -114,7 +115,7 @@ getTemplate("b", function(b) { /******/ var doneFns = inProgress[url]; /******/ delete inProgress[url]; /******/ script.parentNode && script.parentNode.removeChild(script); -/******/ doneFns && doneFns.forEach((fn) => fn(event)); +/******/ doneFns && doneFns.forEach((fn) => (fn(event))); /******/ if(prev) return prev(event); /******/ } /******/ ; @@ -136,12 +137,11 @@ getTemplate("b", function(b) { /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched -/******/ // Promise = chunk loading, 0 = chunk loaded +/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 179: 0 /******/ }; /******/ -/******/ /******/ __webpack_require__.f.j = (chunkId, promises) => { /******/ // JSONP chunk loading for javascript /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined; @@ -153,9 +153,7 @@ getTemplate("b", function(b) { /******/ } else { /******/ if(true) { // all chunks have JS /******/ // setup Promise in chunk cache -/******/ var promise = new Promise((resolve, reject) => { -/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; -/******/ }); +/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject])); /******/ promises.push(installedChunkData[2] = promise); /******/ /******/ // start chunk loading @@ -177,7 +175,7 @@ getTemplate("b", function(b) { /******/ } /******/ } /******/ }; -/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId); +/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId); /******/ } else installedChunks[chunkId] = 0; /******/ } /******/ } @@ -191,30 +189,29 @@ getTemplate("b", function(b) { /******/ /******/ // no HMR manifest /******/ -/******/ // no deferred startup +/******/ // no on chunks loaded /******/ /******/ // install a JSONP callback for chunk loading /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { /******/ var [chunkIds, moreModules, runtime] = data; /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, resolves = []; +/******/ var moduleId, chunkId, i = 0; +/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { +/******/ for(moduleId in moreModules) { +/******/ if(__webpack_require__.o(moreModules, moduleId)) { +/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(runtime) var result = runtime(__webpack_require__); +/******/ } +/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); /******/ for(;i < chunkIds.length; i++) { /******/ chunkId = chunkIds[i]; /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { -/******/ resolves.push(installedChunks[chunkId][0]); +/******/ installedChunks[chunkId][0](); /******/ } -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ for(moduleId in moreModules) { -/******/ if(__webpack_require__.o(moreModules, moduleId)) { -/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; -/******/ } -/******/ } -/******/ if(runtime) runtime(__webpack_require__); -/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); -/******/ while(resolves.length) { -/******/ resolves.shift()(); +/******/ installedChunks[chunkIds[i]] = 0; /******/ } /******/ /******/ } @@ -222,8 +219,6 @@ getTemplate("b", function(b) { /******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || []; /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); -/******/ -/******/ // no deferred startup /******/ })(); /******/ /************************************************************************/ @@ -232,6 +227,7 @@ getTemplate("b", function(b) { ``` js +var __webpack_exports__ = {}; /*!********************!*\ !*** ./example.js ***! \********************/ @@ -348,9 +344,9 @@ module.exports = function() { ``` asset output.js 8.96 KiB [emitted] (name: main) asset 577.output.js 2.23 KiB [emitted] -chunk (runtime: main) output.js (main) 266 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 266 bytes (javascript) 4.98 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 4.97 KiB 6 modules + runtime modules 4.98 KiB 6 modules ./example.js 266 bytes [built] [code generated] [used exports unknown] entry ./example.js main @@ -361,17 +357,17 @@ chunk (runtime: main) 577.output.js 457 bytes [rendered] [no exports] [used exports unknown] cjs require context ./example.js 3:11-64 -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` ## Production mode ``` -asset output.js 1.79 KiB [emitted] [minimized] (name: main) +asset output.js 1.8 KiB [emitted] [minimized] (name: main) asset 577.output.js 609 bytes [emitted] [minimized] -chunk (runtime: main) output.js (main) 266 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 266 bytes (javascript) 4.98 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 4.97 KiB 6 modules + runtime modules 4.98 KiB 6 modules ./example.js 266 bytes [built] [code generated] [no exports used] entry ./example.js main @@ -381,5 +377,5 @@ chunk (runtime: main) 577.output.js 457 bytes [rendered] ../require.context/templates/ sync ^\.\/.*$ 217 bytes [built] [code generated] [no exports] cjs require context ./example.js 3:11-64 -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` diff --git a/examples/code-splitting-bundle-loader/README.md b/examples/code-splitting-bundle-loader/README.md index 25c3fe5aed7..cd6d8e87bb4 100644 --- a/examples/code-splitting-bundle-loader/README.md +++ b/examples/code-splitting-bundle-loader/README.md @@ -60,8 +60,9 @@ __webpack_require__.e(/*! require.ensure */ 929).then((function(require) { /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -105,7 +106,7 @@ __webpack_require__.e(/*! require.ensure */ 929).then((function(require) { /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop) +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/load script */ @@ -113,7 +114,7 @@ __webpack_require__.e(/*! require.ensure */ 929).then((function(require) { /******/ var inProgress = {}; /******/ // data-webpack is not used as build has no uniqueName /******/ // loadScript function to load a script via script tag -/******/ __webpack_require__.l = (url, done, key) => { +/******/ __webpack_require__.l = (url, done, key, chunkId) => { /******/ if(inProgress[url]) { inProgress[url].push(done); return; } /******/ var script, needAttach; /******/ if(key !== undefined) { @@ -143,7 +144,7 @@ __webpack_require__.e(/*! require.ensure */ 929).then((function(require) { /******/ var doneFns = inProgress[url]; /******/ delete inProgress[url]; /******/ script.parentNode && script.parentNode.removeChild(script); -/******/ doneFns && doneFns.forEach((fn) => fn(event)); +/******/ doneFns && doneFns.forEach((fn) => (fn(event))); /******/ if(prev) return prev(event); /******/ } /******/ ; @@ -165,12 +166,11 @@ __webpack_require__.e(/*! require.ensure */ 929).then((function(require) { /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched -/******/ // Promise = chunk loading, 0 = chunk loaded +/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 179: 0 /******/ }; /******/ -/******/ /******/ __webpack_require__.f.j = (chunkId, promises) => { /******/ // JSONP chunk loading for javascript /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined; @@ -182,9 +182,7 @@ __webpack_require__.e(/*! require.ensure */ 929).then((function(require) { /******/ } else { /******/ if(true) { // all chunks have JS /******/ // setup Promise in chunk cache -/******/ var promise = new Promise((resolve, reject) => { -/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; -/******/ }); +/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject])); /******/ promises.push(installedChunkData[2] = promise); /******/ /******/ // start chunk loading @@ -206,7 +204,7 @@ __webpack_require__.e(/*! require.ensure */ 929).then((function(require) { /******/ } /******/ } /******/ }; -/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId); +/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId); /******/ } else installedChunks[chunkId] = 0; /******/ } /******/ } @@ -220,30 +218,29 @@ __webpack_require__.e(/*! require.ensure */ 929).then((function(require) { /******/ /******/ // no HMR manifest /******/ -/******/ // no deferred startup +/******/ // no on chunks loaded /******/ /******/ // install a JSONP callback for chunk loading /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { /******/ var [chunkIds, moreModules, runtime] = data; /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, resolves = []; +/******/ var moduleId, chunkId, i = 0; +/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { +/******/ for(moduleId in moreModules) { +/******/ if(__webpack_require__.o(moreModules, moduleId)) { +/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(runtime) var result = runtime(__webpack_require__); +/******/ } +/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); /******/ for(;i < chunkIds.length; i++) { /******/ chunkId = chunkIds[i]; /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { -/******/ resolves.push(installedChunks[chunkId][0]); +/******/ installedChunks[chunkId][0](); /******/ } -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ for(moduleId in moreModules) { -/******/ if(__webpack_require__.o(moreModules, moduleId)) { -/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; -/******/ } -/******/ } -/******/ if(runtime) runtime(__webpack_require__); -/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); -/******/ while(resolves.length) { -/******/ resolves.shift()(); +/******/ installedChunks[chunkIds[i]] = 0; /******/ } /******/ /******/ } @@ -251,8 +248,6 @@ __webpack_require__.e(/*! require.ensure */ 929).then((function(require) { /******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || []; /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); -/******/ -/******/ // no deferred startup /******/ })(); /******/ /************************************************************************/ @@ -261,6 +256,8 @@ __webpack_require__.e(/*! require.ensure */ 929).then((function(require) { ``` js +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { /*!********************!*\ !*** ./example.js ***! @@ -303,11 +300,11 @@ module.exports = "It works"; ## Unoptimized ``` -asset output.js 9.58 KiB [emitted] (name: main) +asset output.js 9.7 KiB [emitted] (name: main) asset 929.output.js 354 bytes [emitted] -chunk (runtime: main) output.js (main) 375 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 375 bytes (javascript) 4.98 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 4.97 KiB 6 modules + runtime modules 4.98 KiB 6 modules dependent modules 281 bytes [dependent] 1 module ./example.js 94 bytes [built] [code generated] [used exports unknown] @@ -318,17 +315,17 @@ chunk (runtime: main) 929.output.js 28 bytes [rendered] [used exports unknown] cjs self exports reference ./file.js 1:0-14 cjs require !!./file.js ../../node_modules/bundle-loader/index.js!./file.js 8:8-30 -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` ## Production mode ``` -asset output.js 1.84 KiB [emitted] [minimized] (name: main) +asset output.js 1.85 KiB [emitted] [minimized] (name: main) asset 929.output.js 88 bytes [emitted] [minimized] -chunk (runtime: main) output.js (main) 375 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 375 bytes (javascript) 4.98 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 4.97 KiB 6 modules + runtime modules 4.98 KiB 6 modules dependent modules 281 bytes [dependent] 1 module ./example.js 94 bytes [built] [code generated] [no exports used] @@ -339,5 +336,5 @@ chunk (runtime: main) 929.output.js 28 bytes [rendered] [used exports unknown] cjs self exports reference ./file.js 1:0-14 cjs require !!./file.js ../../node_modules/bundle-loader/index.js!./file.js 8:8-30 -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` diff --git a/examples/code-splitting-depend-on-advanced/README.md b/examples/code-splitting-depend-on-advanced/README.md index 66766b04e01..f0a1b82b235 100644 --- a/examples/code-splitting-depend-on-advanced/README.md +++ b/examples/code-splitting-depend-on-advanced/README.md @@ -79,8 +79,9 @@ console.log(lodash, isomorphicFetch); /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -99,17 +100,46 @@ console.log(lodash, isomorphicFetch); /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = __webpack_modules__; /******/ -/******/ // the startup function -/******/ // It's empty as some runtime module handles the default behavior -/******/ __webpack_require__.x = x => {} /************************************************************************/ +/******/ /* webpack/runtime/chunk loaded */ +/******/ (() => { +/******/ var deferred = []; +/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => { +/******/ if(chunkIds) { +/******/ priority = priority || 0; +/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; +/******/ deferred[i] = [chunkIds, fn, priority]; +/******/ return; +/******/ } +/******/ var notFulfilled = Infinity; +/******/ for (var i = 0; i < deferred.length; i++) { +/******/ var [chunkIds, fn, priority] = deferred[i]; +/******/ var fulfilled = true; +/******/ for (var j = 0; j < chunkIds.length; j++) { +/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) { +/******/ chunkIds.splice(j--, 1); +/******/ } else { +/******/ fulfilled = false; +/******/ if(priority < notFulfilled) notFulfilled = priority; +/******/ } +/******/ } +/******/ if(fulfilled) { +/******/ deferred.splice(i--, 1) +/******/ var r = fn(); +/******/ if (r !== undefined) result = r; +/******/ } +/******/ } +/******/ return result; +/******/ }; +/******/ })(); +/******/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? -/******/ () => module['default'] : -/******/ () => module; +/******/ () => (module['default']) : +/******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; @@ -151,7 +181,7 @@ console.log(lodash, isomorphicFetch); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop) +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/load script */ @@ -159,7 +189,7 @@ console.log(lodash, isomorphicFetch); /******/ var inProgress = {}; /******/ // data-webpack is not used as build has no uniqueName /******/ // loadScript function to load a script via script tag -/******/ __webpack_require__.l = (url, done, key) => { +/******/ __webpack_require__.l = (url, done, key, chunkId) => { /******/ if(inProgress[url]) { inProgress[url].push(done); return; } /******/ var script, needAttach; /******/ if(key !== undefined) { @@ -189,7 +219,7 @@ console.log(lodash, isomorphicFetch); /******/ var doneFns = inProgress[url]; /******/ delete inProgress[url]; /******/ script.parentNode && script.parentNode.removeChild(script); -/******/ doneFns && doneFns.forEach((fn) => fn(event)); +/******/ doneFns && doneFns.forEach((fn) => (fn(event))); /******/ if(prev) return prev(event); /******/ } /******/ ; @@ -222,14 +252,11 @@ console.log(lodash, isomorphicFetch); /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched -/******/ // Promise = chunk loading, 0 = chunk loaded +/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ "runtime": 0 /******/ }; /******/ -/******/ var deferredModules = [ -/******/ -/******/ ]; /******/ __webpack_require__.f.j = (chunkId, promises) => { /******/ // JSONP chunk loading for javascript /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined; @@ -239,11 +266,9 @@ console.log(lodash, isomorphicFetch); /******/ if(installedChunkData) { /******/ promises.push(installedChunkData[2]); /******/ } else { -/******/ if(true) { // all chunks have JS +/******/ if("runtime" != chunkId) { /******/ // setup Promise in chunk cache -/******/ var promise = new Promise((resolve, reject) => { -/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; -/******/ }); +/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject])); /******/ promises.push(installedChunkData[2] = promise); /******/ /******/ // start chunk loading @@ -265,7 +290,7 @@ console.log(lodash, isomorphicFetch); /******/ } /******/ } /******/ }; -/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId); +/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId); /******/ } else installedChunks[chunkId] = 0; /******/ } /******/ } @@ -279,69 +304,36 @@ console.log(lodash, isomorphicFetch); /******/ /******/ // no HMR manifest /******/ -/******/ var checkDeferredModules = x => {}; +/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0); /******/ /******/ // install a JSONP callback for chunk loading /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { -/******/ var [chunkIds, moreModules, runtime, executeModules] = data; +/******/ var [chunkIds, moreModules, runtime] = data; /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, resolves = []; +/******/ var moduleId, chunkId, i = 0; +/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { +/******/ for(moduleId in moreModules) { +/******/ if(__webpack_require__.o(moreModules, moduleId)) { +/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(runtime) var result = runtime(__webpack_require__); +/******/ } +/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); /******/ for(;i < chunkIds.length; i++) { /******/ chunkId = chunkIds[i]; /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { -/******/ resolves.push(installedChunks[chunkId][0]); -/******/ } -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ for(moduleId in moreModules) { -/******/ if(__webpack_require__.o(moreModules, moduleId)) { -/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ installedChunks[chunkId][0](); /******/ } +/******/ installedChunks[chunkIds[i]] = 0; /******/ } -/******/ if(runtime) runtime(__webpack_require__); -/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); -/******/ while(resolves.length) { -/******/ resolves.shift()(); -/******/ } -/******/ -/******/ // add entry modules from loaded chunk to deferred list -/******/ if(executeModules) deferredModules.push.apply(deferredModules, executeModules); -/******/ -/******/ // run deferred modules when all chunks ready -/******/ return checkDeferredModules(); +/******/ return __webpack_require__.O(result); /******/ } /******/ /******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || []; /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); -/******/ -/******/ function checkDeferredModulesImpl() { -/******/ var result; -/******/ for(var i = 0; i < deferredModules.length; i++) { -/******/ var deferredModule = deferredModules[i]; -/******/ var fulfilled = true; -/******/ for(var j = 1; j < deferredModule.length; j++) { -/******/ var depId = deferredModule[j]; -/******/ if(installedChunks[depId] !== 0) fulfilled = false; -/******/ } -/******/ if(fulfilled) { -/******/ deferredModules.splice(i--, 1); -/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]); -/******/ } -/******/ } -/******/ if(deferredModules.length === 0) { -/******/ __webpack_require__.x(); -/******/ __webpack_require__.x = x => {}; -/******/ } -/******/ return result; -/******/ } -/******/ var startup = __webpack_require__.x; -/******/ __webpack_require__.x = () => { -/******/ // reset startup function so it can be called again when more startup code is added -/******/ __webpack_require__.x = startup || (x => {}); -/******/ return (checkDeferredModules = checkDeferredModulesImpl)(); -/******/ }; /******/ })(); /******/ /************************************************************************/ @@ -350,8 +342,8 @@ console.log(lodash, isomorphicFetch); ``` js -/******/ // run startup -/******/ return __webpack_require__.x(); +/******/ +/******/ /******/ })() ; ``` @@ -359,9 +351,10 @@ console.log(lodash, isomorphicFetch); # dist/app.js ```javascript +"use strict"; (self["webpackChunk"] = self["webpackChunk"] || []).push([["app"],{ -/***/ 7: +/***/ 6: /*!****************!*\ !*** ./app.js ***! \****************/ @@ -370,7 +363,6 @@ console.log(lodash, isomorphicFetch); /*! runtime requirements: __webpack_require__, __webpack_require__.n, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -"use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var isomorphic_fetch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! isomorphic-fetch */ 5); /* harmony import */ var isomorphic_fetch__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(isomorphic_fetch__WEBPACK_IMPORTED_MODULE_0__); @@ -385,15 +377,21 @@ console.log((isomorphic_fetch__WEBPACK_IMPORTED_MODULE_0___default()), (lodash__ /***/ }) }, -0,[[7,"runtime","other-vendors"]]]); +/******/ __webpack_require__ => { // webpackRuntimeModules +/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId)) +/******/ __webpack_require__.O(0, ["other-vendors"], () => (__webpack_exec__(6))); +/******/ var __webpack_exports__ = __webpack_require__.O(); +/******/ } +]); ``` # dist/page1.js ```javascript +"use strict"; (self["webpackChunk"] = self["webpackChunk"] || []).push([["page1"],{ -/***/ 6: +/***/ 7: /*!******************!*\ !*** ./page1.js ***! \******************/ @@ -402,7 +400,6 @@ console.log((isomorphic_fetch__WEBPACK_IMPORTED_MODULE_0___default()), (lodash__ /*! runtime requirements: __webpack_require__, __webpack_require__.n, __webpack_require__.r, __webpack_exports__, __webpack_require__.e, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -"use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var isomorphic_fetch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! isomorphic-fetch */ 5); /* harmony import */ var isomorphic_fetch__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(isomorphic_fetch__WEBPACK_IMPORTED_MODULE_0__); @@ -422,7 +419,12 @@ __webpack_require__.e(/*! import() */ "lazy_js").then(__webpack_require__.bind(_ /***/ }) }, -0,[[6,"app","runtime","react-vendors","other-vendors"]]]); +/******/ __webpack_require__ => { // webpackRuntimeModules +/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId)) +/******/ __webpack_require__.O(0, ["app","react-vendors","other-vendors"], () => (__webpack_exec__(7))); +/******/ var __webpack_exports__ = __webpack_require__.O(); +/******/ } +]); ``` # dist/other-vendors.js @@ -482,7 +484,11 @@ module.exports = "isomorphic-fetch"; /***/ }) ], -0,[[3,"runtime"]]]); +/******/ __webpack_require__ => { // webpackRuntimeModules +/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId)) +/******/ var __webpack_exports__ = (__webpack_exec__(3)); +/******/ } +]); ``` # dist/react-vendors.js @@ -529,7 +535,11 @@ module.exports = 'prop-types'; /***/ }) ], -0,[[0,"runtime"],[1,"runtime"],[2,"runtime"]]]); +/******/ __webpack_require__ => { // webpackRuntimeModules +/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId)) +/******/ var __webpack_exports__ = (__webpack_exec__(0), __webpack_exec__(1), __webpack_exec__(2)); +/******/ } +]); ``` # Info @@ -537,16 +547,16 @@ module.exports = 'prop-types'; ## Unoptimized ``` -asset runtime.js 11.4 KiB [emitted] (name: runtime) -asset other-vendors.js 1.92 KiB [emitted] (name: other-vendors) -asset page1.js 1.64 KiB [emitted] (name: page1) -asset app.js 1.17 KiB [emitted] (name: app) +asset runtime.js 11.1 KiB [emitted] (name: runtime) +asset other-vendors.js 2.13 KiB [emitted] (name: other-vendors) +asset page1.js 1.91 KiB [emitted] (name: page1) +asset app.js 1.44 KiB [emitted] (name: app) +asset react-vendors.js 1.33 KiB [emitted] (name: react-vendors) asset lazy_js.js 1.11 KiB [emitted] -asset react-vendors.js 1.1 KiB [emitted] (name: react-vendors) -Entrypoint app 1.17 KiB = app.js -Entrypoint page1 1.64 KiB = page1.js -Entrypoint react-vendors 12.5 KiB = runtime.js 11.4 KiB react-vendors.js 1.1 KiB -Entrypoint other-vendors 13.3 KiB = runtime.js 11.4 KiB other-vendors.js 1.92 KiB +Entrypoint app 1.44 KiB = app.js +Entrypoint page1 1.91 KiB = page1.js +Entrypoint react-vendors 12.5 KiB = runtime.js 11.1 KiB react-vendors.js 1.33 KiB +Entrypoint other-vendors 13.3 KiB = runtime.js 11.1 KiB other-vendors.js 2.13 KiB chunk (runtime: runtime) app.js (app) 116 bytes <{other-vendors}> <{runtime}> >{page1}< [initial] [rendered] > ./app.js app ./app.js 116 bytes [built] [code generated] @@ -578,44 +588,47 @@ chunk (runtime: runtime) react-vendors.js (react-vendors) 87 bytes ={runtime}= > > react-dom react-vendors ./node_modules/prop-types.js 31 bytes [built] [code generated] [used exports unknown] - harmony side effect evaluation prop-types ./lazy.js 2:0-35 - harmony import specifier prop-types ./lazy.js 4:20-29 + from origin ./lazy.js + harmony side effect evaluation prop-types ./lazy.js 2:0-35 + harmony import specifier prop-types ./lazy.js 4:20-29 cjs self exports reference ./node_modules/prop-types.js 1:0-14 entry prop-types react-vendors ./node_modules/react-dom.js 30 bytes [built] [code generated] [used exports unknown] + from origin ./page1.js + harmony side effect evaluation react-dom ./page1.js 3:0-33 + harmony import specifier react-dom ./page1.js 5:36-44 cjs self exports reference ./node_modules/react-dom.js 1:0-14 - harmony side effect evaluation react-dom ./page1.js 3:0-33 - harmony import specifier react-dom ./page1.js 5:36-44 entry react-dom react-vendors ./node_modules/react.js 26 bytes [built] [code generated] [used exports unknown] + from origin ./page1.js + harmony side effect evaluation react ./page1.js 2:0-26 + harmony import specifier react ./page1.js 5:29-34 cjs self exports reference ./node_modules/react.js 1:0-14 - harmony side effect evaluation react ./page1.js 2:0-26 - harmony import specifier react ./page1.js 5:29-34 entry react react-vendors -chunk (runtime: runtime) runtime.js (runtime) 6.85 KiB ={other-vendors}= ={react-vendors}= >{app}< >{page1}< [entry] [rendered] +chunk (runtime: runtime) runtime.js (runtime) 6.75 KiB ={other-vendors}= ={react-vendors}= >{app}< >{page1}< [entry] [rendered] > ./other-vendors other-vendors > prop-types react-vendors > react react-vendors > react-dom react-vendors - runtime modules 6.85 KiB 9 modules -webpack 5.11.1 compiled successfully + runtime modules 6.75 KiB 10 modules +webpack 5.51.1 compiled successfully ``` ## Production mode ``` -asset runtime.js 2.26 KiB [emitted] [minimized] (name: runtime) -asset page1.js 264 bytes [emitted] [minimized] (name: page1) -asset other-vendors.js 243 bytes [emitted] [minimized] (name: other-vendors) -asset react-vendors.js 208 bytes [emitted] [minimized] (name: react-vendors) -asset app.js 184 bytes [emitted] [minimized] (name: app) +asset runtime.js 2.37 KiB [emitted] [minimized] (name: runtime) +asset page1.js 287 bytes [emitted] [minimized] (name: page1) +asset other-vendors.js 239 bytes [emitted] [minimized] (name: other-vendors) +asset app.js 207 bytes [emitted] [minimized] (name: app) +asset react-vendors.js 200 bytes [emitted] [minimized] (name: react-vendors) asset lazy_js.js 159 bytes [emitted] [minimized] -Entrypoint app 184 bytes = app.js -Entrypoint page1 264 bytes = page1.js -Entrypoint react-vendors 2.46 KiB = runtime.js 2.26 KiB react-vendors.js 208 bytes -Entrypoint other-vendors 2.5 KiB = runtime.js 2.26 KiB other-vendors.js 243 bytes +Entrypoint app 207 bytes = app.js +Entrypoint page1 287 bytes = page1.js +Entrypoint react-vendors 2.57 KiB = runtime.js 2.37 KiB react-vendors.js 200 bytes +Entrypoint other-vendors 2.6 KiB = runtime.js 2.37 KiB other-vendors.js 239 bytes chunk (runtime: runtime) app.js (app) 116 bytes <{other-vendors}> <{runtime}> >{page1}< [initial] [rendered] > ./app.js app ./app.js 116 bytes [built] [code generated] @@ -646,27 +659,30 @@ chunk (runtime: runtime) react-vendors.js (react-vendors) 87 bytes ={runtime}= > > react-dom react-vendors ./node_modules/prop-types.js 31 bytes [built] [code generated] [used exports unknown] - harmony side effect evaluation prop-types ./lazy.js 2:0-35 - harmony import specifier prop-types ./lazy.js 4:20-29 + from origin ./lazy.js + harmony side effect evaluation prop-types ./lazy.js 2:0-35 + harmony import specifier prop-types ./lazy.js 4:20-29 cjs self exports reference ./node_modules/prop-types.js 1:0-14 entry prop-types react-vendors ./node_modules/react-dom.js 30 bytes [built] [code generated] [used exports unknown] + from origin ./page1.js + harmony side effect evaluation react-dom ./page1.js 3:0-33 + harmony import specifier react-dom ./page1.js 5:36-44 cjs self exports reference ./node_modules/react-dom.js 1:0-14 - harmony side effect evaluation react-dom ./page1.js 3:0-33 - harmony import specifier react-dom ./page1.js 5:36-44 entry react-dom react-vendors ./node_modules/react.js 26 bytes [built] [code generated] [used exports unknown] + from origin ./page1.js + harmony side effect evaluation react ./page1.js 2:0-26 + harmony import specifier react ./page1.js 5:29-34 cjs self exports reference ./node_modules/react.js 1:0-14 - harmony side effect evaluation react ./page1.js 2:0-26 - harmony import specifier react ./page1.js 5:29-34 entry react react-vendors -chunk (runtime: runtime) runtime.js (runtime) 6.85 KiB ={other-vendors}= ={react-vendors}= >{app}< >{page1}< [entry] [rendered] +chunk (runtime: runtime) runtime.js (runtime) 6.75 KiB ={other-vendors}= ={react-vendors}= >{app}< >{page1}< [entry] [rendered] > ./other-vendors other-vendors > prop-types react-vendors > react react-vendors > react-dom react-vendors - runtime modules 6.85 KiB 9 modules -webpack 5.11.1 compiled successfully + runtime modules 6.75 KiB 10 modules +webpack 5.51.1 compiled successfully ``` diff --git a/examples/code-splitting-depend-on-simple/README.md b/examples/code-splitting-depend-on-simple/README.md index ce39033f28e..34074dd70cb 100644 --- a/examples/code-splitting-depend-on-simple/README.md +++ b/examples/code-splitting-depend-on-simple/README.md @@ -31,6 +31,7 @@ console.log(react, reactDOM, propTypes); # dist/app.js ```javascript +"use strict"; (self["webpackChunk"] = self["webpackChunk"] || []).push([["app"],{ /***/ 3: @@ -42,7 +43,6 @@ console.log(react, reactDOM, propTypes); /*! runtime requirements: __webpack_require__, __webpack_require__.n, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -"use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 0); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); @@ -60,7 +60,11 @@ console.log((react__WEBPACK_IMPORTED_MODULE_0___default()), (react_dom__WEBPACK_ /***/ }) }, -0,[[3,"react-vendors"]]]); +/******/ __webpack_require__ => { // webpackRuntimeModules +/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId)) +/******/ var __webpack_exports__ = (__webpack_exec__(3)); +/******/ } +]); ``` # dist/react-vendors.js @@ -120,8 +124,9 @@ module.exports = 'prop-types'; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -140,17 +145,46 @@ module.exports = 'prop-types'; /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = __webpack_modules__; /******/ -/******/ // the startup function -/******/ // It's empty as some runtime module handles the default behavior -/******/ __webpack_require__.x = x => {} /************************************************************************/ +/******/ /* webpack/runtime/chunk loaded */ +/******/ (() => { +/******/ var deferred = []; +/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => { +/******/ if(chunkIds) { +/******/ priority = priority || 0; +/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; +/******/ deferred[i] = [chunkIds, fn, priority]; +/******/ return; +/******/ } +/******/ var notFulfilled = Infinity; +/******/ for (var i = 0; i < deferred.length; i++) { +/******/ var [chunkIds, fn, priority] = deferred[i]; +/******/ var fulfilled = true; +/******/ for (var j = 0; j < chunkIds.length; j++) { +/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) { +/******/ chunkIds.splice(j--, 1); +/******/ } else { +/******/ fulfilled = false; +/******/ if(priority < notFulfilled) notFulfilled = priority; +/******/ } +/******/ } +/******/ if(fulfilled) { +/******/ deferred.splice(i--, 1) +/******/ var r = fn(); +/******/ if (r !== undefined) result = r; +/******/ } +/******/ } +/******/ return result; +/******/ }; +/******/ })(); +/******/ /******/ /* webpack/runtime/compat get default export */ /******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? -/******/ () => module['default'] : -/******/ () => module; +/******/ () => (module['default']) : +/******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; @@ -170,7 +204,7 @@ module.exports = 'prop-types'; /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop) +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ @@ -190,16 +224,11 @@ module.exports = 'prop-types'; /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched -/******/ // Promise = chunk loading, 0 = chunk loaded +/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ "react-vendors": 0 /******/ }; /******/ -/******/ var deferredModules = [ -/******/ [0], -/******/ [1], -/******/ [2] -/******/ ]; /******/ // no chunk on demand loading /******/ /******/ // no prefetching @@ -210,69 +239,36 @@ module.exports = 'prop-types'; /******/ /******/ // no HMR manifest /******/ -/******/ var checkDeferredModules = x => {}; +/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0); /******/ /******/ // install a JSONP callback for chunk loading /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { -/******/ var [chunkIds, moreModules, runtime, executeModules] = data; +/******/ var [chunkIds, moreModules, runtime] = data; /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, resolves = []; +/******/ var moduleId, chunkId, i = 0; +/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { +/******/ for(moduleId in moreModules) { +/******/ if(__webpack_require__.o(moreModules, moduleId)) { +/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(runtime) var result = runtime(__webpack_require__); +/******/ } +/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); /******/ for(;i < chunkIds.length; i++) { /******/ chunkId = chunkIds[i]; /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { -/******/ resolves.push(installedChunks[chunkId][0]); -/******/ } -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ for(moduleId in moreModules) { -/******/ if(__webpack_require__.o(moreModules, moduleId)) { -/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ installedChunks[chunkId][0](); /******/ } +/******/ installedChunks[chunkIds[i]] = 0; /******/ } -/******/ if(runtime) runtime(__webpack_require__); -/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); -/******/ while(resolves.length) { -/******/ resolves.shift()(); -/******/ } -/******/ -/******/ // add entry modules from loaded chunk to deferred list -/******/ if(executeModules) deferredModules.push.apply(deferredModules, executeModules); -/******/ -/******/ // run deferred modules when all chunks ready -/******/ return checkDeferredModules(); +/******/ return __webpack_require__.O(result); /******/ } /******/ /******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || []; /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); -/******/ -/******/ function checkDeferredModulesImpl() { -/******/ var result; -/******/ for(var i = 0; i < deferredModules.length; i++) { -/******/ var deferredModule = deferredModules[i]; -/******/ var fulfilled = true; -/******/ for(var j = 1; j < deferredModule.length; j++) { -/******/ var depId = deferredModule[j]; -/******/ if(installedChunks[depId] !== 0) fulfilled = false; -/******/ } -/******/ if(fulfilled) { -/******/ deferredModules.splice(i--, 1); -/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]); -/******/ } -/******/ } -/******/ if(deferredModules.length === 0) { -/******/ __webpack_require__.x(); -/******/ __webpack_require__.x = x => {}; -/******/ } -/******/ return result; -/******/ } -/******/ var startup = __webpack_require__.x; -/******/ __webpack_require__.x = () => { -/******/ // reset startup function so it can be called again when more startup code is added -/******/ __webpack_require__.x = startup || (x => {}); -/******/ return (checkDeferredModules = checkDeferredModulesImpl)(); -/******/ }; /******/ })(); /******/ /************************************************************************/ @@ -281,8 +277,15 @@ module.exports = 'prop-types'; ``` js -/******/ // run startup -/******/ return __webpack_require__.x(); +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module is referenced by other modules so it can't be inlined +/******/ __webpack_require__(0); +/******/ __webpack_require__(1); +/******/ var __webpack_exports__ = __webpack_require__(2); +/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); +/******/ /******/ })() ; ``` @@ -292,75 +295,81 @@ module.exports = 'prop-types'; ## Unoptimized ``` -asset react-vendors.js 7.56 KiB [emitted] (name: react-vendors) -asset app.js 1.43 KiB [emitted] (name: app) +asset react-vendors.js 7.62 KiB [emitted] (name: react-vendors) +asset app.js 1.63 KiB [emitted] (name: app) chunk (runtime: react-vendors) app.js (app) 139 bytes <{react-vendors}> [initial] [rendered] > ./app.js app ./app.js 139 bytes [built] [code generated] [no exports] [used exports unknown] entry ./app.js app -chunk (runtime: react-vendors) react-vendors.js (react-vendors) 87 bytes (javascript) 3.42 KiB (runtime) >{app}< [entry] [rendered] +chunk (runtime: react-vendors) react-vendors.js (react-vendors) 87 bytes (javascript) 3.3 KiB (runtime) >{app}< [entry] [rendered] > prop-types react-vendors > react react-vendors > react-dom react-vendors - runtime modules 3.42 KiB 5 modules + runtime modules 3.3 KiB 6 modules cacheable modules 87 bytes ./node_modules/prop-types.js 31 bytes [built] [code generated] [used exports unknown] - harmony side effect evaluation prop-types ./app.js 3:0-35 - harmony import specifier prop-types ./app.js 5:29-38 + from origin ./app.js + harmony side effect evaluation prop-types ./app.js 3:0-35 + harmony import specifier prop-types ./app.js 5:29-38 cjs self exports reference ./node_modules/prop-types.js 1:0-14 entry prop-types react-vendors ./node_modules/react-dom.js 30 bytes [built] [code generated] [used exports unknown] - harmony side effect evaluation react-dom ./app.js 2:0-33 - harmony import specifier react-dom ./app.js 5:19-27 + from origin ./app.js + harmony side effect evaluation react-dom ./app.js 2:0-33 + harmony import specifier react-dom ./app.js 5:19-27 cjs self exports reference ./node_modules/react-dom.js 1:0-14 entry react-dom react-vendors ./node_modules/react.js 26 bytes [built] [code generated] [used exports unknown] - harmony side effect evaluation react ./app.js 1:0-26 - harmony import specifier react ./app.js 5:12-17 + from origin ./app.js + harmony side effect evaluation react ./app.js 1:0-26 + harmony import specifier react ./app.js 5:12-17 cjs self exports reference ./node_modules/react.js 1:0-14 entry react react-vendors -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` ## Production mode ``` -asset react-vendors.js 1.05 KiB [emitted] [minimized] (name: react-vendors) -asset app.js 195 bytes [emitted] [minimized] (name: app) +asset react-vendors.js 1.15 KiB [emitted] [minimized] (name: react-vendors) +asset app.js 185 bytes [emitted] [minimized] (name: app) chunk (runtime: react-vendors) app.js (app) 139 bytes <{react-vendors}> [initial] [rendered] > ./app.js app ./app.js 139 bytes [built] [code generated] [no exports] [no exports used] entry ./app.js app -chunk (runtime: react-vendors) react-vendors.js (react-vendors) 87 bytes (javascript) 3.15 KiB (runtime) >{app}< [entry] [rendered] +chunk (runtime: react-vendors) react-vendors.js (react-vendors) 87 bytes (javascript) 3.03 KiB (runtime) >{app}< [entry] [rendered] > prop-types react-vendors > react react-vendors > react-dom react-vendors - runtime modules 3.15 KiB 4 modules + runtime modules 3.03 KiB 5 modules cacheable modules 87 bytes ./node_modules/prop-types.js 31 bytes [built] [code generated] [used exports unknown] - harmony side effect evaluation prop-types ./app.js 3:0-35 - harmony import specifier prop-types ./app.js 5:29-38 + from origin ./app.js + harmony side effect evaluation prop-types ./app.js 3:0-35 + harmony import specifier prop-types ./app.js 5:29-38 cjs self exports reference ./node_modules/prop-types.js 1:0-14 entry prop-types react-vendors ./node_modules/react-dom.js 30 bytes [built] [code generated] [used exports unknown] - harmony side effect evaluation react-dom ./app.js 2:0-33 - harmony import specifier react-dom ./app.js 5:19-27 + from origin ./app.js + harmony side effect evaluation react-dom ./app.js 2:0-33 + harmony import specifier react-dom ./app.js 5:19-27 cjs self exports reference ./node_modules/react-dom.js 1:0-14 entry react-dom react-vendors ./node_modules/react.js 26 bytes [built] [code generated] [used exports unknown] - harmony side effect evaluation react ./app.js 1:0-26 - harmony import specifier react ./app.js 5:12-17 + from origin ./app.js + harmony side effect evaluation react ./app.js 1:0-26 + harmony import specifier react ./app.js 5:12-17 cjs self exports reference ./node_modules/react.js 1:0-14 entry react react-vendors -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` diff --git a/examples/code-splitting-harmony/README.md b/examples/code-splitting-harmony/README.md index 7ffefdb5c4c..53ab39f82b2 100644 --- a/examples/code-splitting-harmony/README.md +++ b/examples/code-splitting-harmony/README.md @@ -29,35 +29,7 @@ Promise.all([loadC("1"), loadC("2")]).then(function(arr) { ```javascript /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ([ -/* 0 */ -/*!********************!*\ - !*** ./example.js ***! - \********************/ -/*! namespace exports */ -/*! exports [not provided] [no usage info] */ -/*! runtime requirements: __webpack_require__, __webpack_require__.n, __webpack_require__.r, __webpack_exports__, __webpack_require__.e, __webpack_require__.t, __webpack_require__.* */ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var a__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! a */ 1); -/* harmony import */ var a__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(a__WEBPACK_IMPORTED_MODULE_0__); - - -__webpack_require__.e(/*! import() */ 644).then(__webpack_require__.t.bind(__webpack_require__, /*! b */ 3, 23)).then(function(b) { - console.log("b loaded", b); -}) - -function loadC(name) { - return __webpack_require__(2)("./" + name); -} - -Promise.all([loadC("1"), loadC("2")]).then(function(arr) { - console.log("c/1 and c/2 loaded", arr); -}); - - -/***/ }), +/* 0 */, /* 1 */ /*!***************************!*\ !*** ./node_modules/a.js ***! @@ -107,10 +79,10 @@ function webpackAsyncContext(req) { var ids = map[req], id = ids[0]; return __webpack_require__.e(ids[1]).then(() => { - return __webpack_require__.t(id, 7); + return __webpack_require__.t(id, 7 | 16); }); } -webpackAsyncContext.keys = () => Object.keys(map); +webpackAsyncContext.keys = () => (Object.keys(map)); webpackAsyncContext.id = 2; module.exports = webpackAsyncContext; @@ -128,8 +100,9 @@ module.exports = webpackAsyncContext; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -154,8 +127,8 @@ module.exports = webpackAsyncContext; /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? -/******/ () => module['default'] : -/******/ () => module; +/******/ () => (module['default']) : +/******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; @@ -163,7 +136,7 @@ module.exports = webpackAsyncContext; /******/ /******/ /* webpack/runtime/create fake namespace object */ /******/ (() => { -/******/ var getProto = Object.getPrototypeOf ? (obj) => Object.getPrototypeOf(obj) : (obj) => obj.__proto__; +/******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__); /******/ var leafPrototypes; /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it @@ -183,9 +156,9 @@ module.exports = webpackAsyncContext; /******/ var def = {}; /******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)]; /******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) { -/******/ Object.getOwnPropertyNames(current).forEach(key => def[key] = () => value[key]); +/******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key]))); /******/ } -/******/ def['default'] = () => value; +/******/ def['default'] = () => (value); /******/ __webpack_require__.d(ns, def); /******/ return ns; /******/ }; @@ -227,7 +200,7 @@ module.exports = webpackAsyncContext; /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop) +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/load script */ @@ -235,7 +208,7 @@ module.exports = webpackAsyncContext; /******/ var inProgress = {}; /******/ // data-webpack is not used as build has no uniqueName /******/ // loadScript function to load a script via script tag -/******/ __webpack_require__.l = (url, done, key) => { +/******/ __webpack_require__.l = (url, done, key, chunkId) => { /******/ if(inProgress[url]) { inProgress[url].push(done); return; } /******/ var script, needAttach; /******/ if(key !== undefined) { @@ -265,7 +238,7 @@ module.exports = webpackAsyncContext; /******/ var doneFns = inProgress[url]; /******/ delete inProgress[url]; /******/ script.parentNode && script.parentNode.removeChild(script); -/******/ doneFns && doneFns.forEach((fn) => fn(event)); +/******/ doneFns && doneFns.forEach((fn) => (fn(event))); /******/ if(prev) return prev(event); /******/ } /******/ ; @@ -298,12 +271,11 @@ module.exports = webpackAsyncContext; /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched -/******/ // Promise = chunk loading, 0 = chunk loaded +/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 179: 0 /******/ }; /******/ -/******/ /******/ __webpack_require__.f.j = (chunkId, promises) => { /******/ // JSONP chunk loading for javascript /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined; @@ -315,9 +287,7 @@ module.exports = webpackAsyncContext; /******/ } else { /******/ if(true) { // all chunks have JS /******/ // setup Promise in chunk cache -/******/ var promise = new Promise((resolve, reject) => { -/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; -/******/ }); +/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject])); /******/ promises.push(installedChunkData[2] = promise); /******/ /******/ // start chunk loading @@ -339,7 +309,7 @@ module.exports = webpackAsyncContext; /******/ } /******/ } /******/ }; -/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId); +/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId); /******/ } else installedChunks[chunkId] = 0; /******/ } /******/ } @@ -353,30 +323,29 @@ module.exports = webpackAsyncContext; /******/ /******/ // no HMR manifest /******/ -/******/ // no deferred startup +/******/ // no on chunks loaded /******/ /******/ // install a JSONP callback for chunk loading /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { /******/ var [chunkIds, moreModules, runtime] = data; /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, resolves = []; +/******/ var moduleId, chunkId, i = 0; +/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { +/******/ for(moduleId in moreModules) { +/******/ if(__webpack_require__.o(moreModules, moduleId)) { +/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(runtime) var result = runtime(__webpack_require__); +/******/ } +/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); /******/ for(;i < chunkIds.length; i++) { /******/ chunkId = chunkIds[i]; /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { -/******/ resolves.push(installedChunks[chunkId][0]); -/******/ } -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ for(moduleId in moreModules) { -/******/ if(__webpack_require__.o(moreModules, moduleId)) { -/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ installedChunks[chunkId][0](); /******/ } -/******/ } -/******/ if(runtime) runtime(__webpack_require__); -/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); -/******/ while(resolves.length) { -/******/ resolves.shift()(); +/******/ installedChunks[chunkIds[i]] = 0; /******/ } /******/ /******/ } @@ -384,8 +353,6 @@ module.exports = webpackAsyncContext; /******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || []; /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); -/******/ -/******/ // no deferred startup /******/ })(); /******/ /************************************************************************/ @@ -394,10 +361,35 @@ module.exports = webpackAsyncContext; ``` js -/******/ // startup -/******/ // Load entry module -/******/ __webpack_require__(0); -/******/ // This entry module used 'exports' so it can't be inlined +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be in strict mode. +(() => { +"use strict"; +/*!********************!*\ + !*** ./example.js ***! + \********************/ +/*! namespace exports */ +/*! exports [not provided] [no usage info] */ +/*! runtime requirements: __webpack_require__, __webpack_require__.n, __webpack_require__.r, __webpack_exports__, __webpack_require__.e, __webpack_require__.t, __webpack_require__.* */ +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var a__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! a */ 1); +/* harmony import */ var a__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(a__WEBPACK_IMPORTED_MODULE_0__); + + +__webpack_require__.e(/*! import() */ 644).then(__webpack_require__.t.bind(__webpack_require__, /*! b */ 3, 23)).then(function(b) { + console.log("b loaded", b); +}) + +function loadC(name) { + return __webpack_require__(2)("./" + name); +} + +Promise.all([loadC("1"), loadC("2")]).then(function(arr) { + console.log("c/1 and c/2 loaded", arr); +}); + +})(); + /******/ })() ; ``` @@ -407,7 +399,7 @@ module.exports = webpackAsyncContext; ## Unoptimized ``` -asset output.js 13.7 KiB [emitted] (name: main) +asset output.js 13.6 KiB [emitted] (name: main) asset 346.output.js 296 bytes [emitted] asset 98.output.js 295 bytes [emitted] asset 644.output.js 288 bytes [emitted] @@ -416,11 +408,11 @@ chunk (runtime: main) 98.output.js 13 bytes [rendered] > ./2.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./2.js ./node_modules/c/2.js 13 bytes [optional] [built] [code generated] [used exports unknown] - context element ./2 ./node_modules/c/ lazy ^\.\/.*$ namespace object ./2 - context element ./2.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./2.js -chunk (runtime: main) output.js (main) 414 bytes (javascript) 6.9 KiB (runtime) [entry] [rendered] + import() context element ./2 ./node_modules/c/ lazy ^\.\/.*$ namespace object ./2 + import() context element ./2.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./2.js +chunk (runtime: main) output.js (main) 414 bytes (javascript) 6.92 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 6.9 KiB 10 modules + runtime modules 6.92 KiB 10 modules dependent modules 171 bytes [dependent] 2 modules ./example.js 243 bytes [built] [code generated] [no exports] @@ -431,14 +423,14 @@ chunk (runtime: main) 346.output.js 13 bytes [rendered] > ./1.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./1.js ./node_modules/c/1.js 13 bytes [optional] [built] [code generated] [used exports unknown] - context element ./1 ./node_modules/c/ lazy ^\.\/.*$ namespace object ./1 - context element ./1.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./1.js + import() context element ./1 ./node_modules/c/ lazy ^\.\/.*$ namespace object ./1 + import() context element ./1.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./1.js chunk (runtime: main) 644.output.js 11 bytes [rendered] > b ./example.js 3:0-11 ./node_modules/b.js 11 bytes [built] [code generated] [used exports unknown] import() b ./example.js 3:0-11 -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` ## Production mode @@ -453,11 +445,11 @@ chunk (runtime: main) 98.output.js 13 bytes [rendered] > ./2.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./2.js ./node_modules/c/2.js 13 bytes [optional] [built] [code generated] [used exports unknown] - context element ./2 ./node_modules/c/ lazy ^\.\/.*$ namespace object ./2 - context element ./2.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./2.js -chunk (runtime: main) output.js (main) 403 bytes (javascript) 6.64 KiB (runtime) [entry] [rendered] + import() context element ./2 ./node_modules/c/ lazy ^\.\/.*$ namespace object ./2 + import() context element ./2.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./2.js +chunk (runtime: main) output.js (main) 403 bytes (javascript) 6.66 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 6.64 KiB 9 modules + runtime modules 6.66 KiB 9 modules dependent modules 160 bytes [dependent] 1 module ./example.js 243 bytes [built] [code generated] [no exports] @@ -468,12 +460,12 @@ chunk (runtime: main) 346.output.js 13 bytes [rendered] > ./1.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./1.js ./node_modules/c/1.js 13 bytes [optional] [built] [code generated] [used exports unknown] - context element ./1 ./node_modules/c/ lazy ^\.\/.*$ namespace object ./1 - context element ./1.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./1.js + import() context element ./1 ./node_modules/c/ lazy ^\.\/.*$ namespace object ./1 + import() context element ./1.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./1.js chunk (runtime: main) 644.output.js 11 bytes [rendered] > b ./example.js 3:0-11 ./node_modules/b.js 11 bytes [built] [code generated] [used exports unknown] import() b ./example.js 3:0-11 -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` diff --git a/examples/code-splitting-native-import-context-filter/README.md b/examples/code-splitting-native-import-context-filter/README.md index 05287021f41..83dd98ef47e 100644 --- a/examples/code-splitting-native-import-context-filter/README.md +++ b/examples/code-splitting-native-import-context-filter/README.md @@ -98,7 +98,7 @@ function webpackAsyncContext(req) { return __webpack_require__(id); }); } -webpackAsyncContext.keys = () => Object.keys(map); +webpackAsyncContext.keys = () => (Object.keys(map)); webpackAsyncContext.id = 1; module.exports = webpackAsyncContext; @@ -116,8 +116,9 @@ module.exports = webpackAsyncContext; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -173,7 +174,7 @@ module.exports = webpackAsyncContext; /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop) +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/load script */ @@ -181,7 +182,7 @@ module.exports = webpackAsyncContext; /******/ var inProgress = {}; /******/ // data-webpack is not used as build has no uniqueName /******/ // loadScript function to load a script via script tag -/******/ __webpack_require__.l = (url, done, key) => { +/******/ __webpack_require__.l = (url, done, key, chunkId) => { /******/ if(inProgress[url]) { inProgress[url].push(done); return; } /******/ var script, needAttach; /******/ if(key !== undefined) { @@ -211,7 +212,7 @@ module.exports = webpackAsyncContext; /******/ var doneFns = inProgress[url]; /******/ delete inProgress[url]; /******/ script.parentNode && script.parentNode.removeChild(script); -/******/ doneFns && doneFns.forEach((fn) => fn(event)); +/******/ doneFns && doneFns.forEach((fn) => (fn(event))); /******/ if(prev) return prev(event); /******/ } /******/ ; @@ -244,12 +245,11 @@ module.exports = webpackAsyncContext; /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched -/******/ // Promise = chunk loading, 0 = chunk loaded +/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 179: 0 /******/ }; /******/ -/******/ /******/ __webpack_require__.f.j = (chunkId, promises) => { /******/ // JSONP chunk loading for javascript /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined; @@ -261,9 +261,7 @@ module.exports = webpackAsyncContext; /******/ } else { /******/ if(true) { // all chunks have JS /******/ // setup Promise in chunk cache -/******/ var promise = new Promise((resolve, reject) => { -/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; -/******/ }); +/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject])); /******/ promises.push(installedChunkData[2] = promise); /******/ /******/ // start chunk loading @@ -285,7 +283,7 @@ module.exports = webpackAsyncContext; /******/ } /******/ } /******/ }; -/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId); +/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId); /******/ } else installedChunks[chunkId] = 0; /******/ } /******/ } @@ -299,30 +297,29 @@ module.exports = webpackAsyncContext; /******/ /******/ // no HMR manifest /******/ -/******/ // no deferred startup +/******/ // no on chunks loaded /******/ /******/ // install a JSONP callback for chunk loading /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { /******/ var [chunkIds, moreModules, runtime] = data; /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, resolves = []; +/******/ var moduleId, chunkId, i = 0; +/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { +/******/ for(moduleId in moreModules) { +/******/ if(__webpack_require__.o(moreModules, moduleId)) { +/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(runtime) var result = runtime(__webpack_require__); +/******/ } +/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); /******/ for(;i < chunkIds.length; i++) { /******/ chunkId = chunkIds[i]; /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { -/******/ resolves.push(installedChunks[chunkId][0]); +/******/ installedChunks[chunkId][0](); /******/ } -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ for(moduleId in moreModules) { -/******/ if(__webpack_require__.o(moreModules, moduleId)) { -/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; -/******/ } -/******/ } -/******/ if(runtime) runtime(__webpack_require__); -/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); -/******/ while(resolves.length) { -/******/ resolves.shift()(); +/******/ installedChunks[chunkIds[i]] = 0; /******/ } /******/ /******/ } @@ -330,8 +327,6 @@ module.exports = webpackAsyncContext; /******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || []; /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); -/******/ -/******/ // no deferred startup /******/ })(); /******/ /************************************************************************/ @@ -340,6 +335,8 @@ module.exports = webpackAsyncContext; ``` js +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { /*!********************!*\ !*** ./example.js ***! @@ -375,10 +372,10 @@ getTemplate("baz.noimport"); ## Unoptimized ``` -asset output.js 11.1 KiB [emitted] (name: main) -asset 398.output.js 856 bytes [emitted] -asset 544.output.js 856 bytes [emitted] -asset 718.output.js 856 bytes [emitted] +asset output.js 11.2 KiB [emitted] (name: main) +asset 398.output.js 858 bytes [emitted] +asset 544.output.js 858 bytes [emitted] +asset 718.output.js 858 bytes [emitted] chunk (runtime: main) output.js (main) 597 bytes (javascript) 5.54 KiB (runtime) [entry] [rendered] > ./example.js main runtime modules 5.54 KiB 8 modules @@ -392,31 +389,31 @@ chunk (runtime: main) 398.output.js 38 bytes [rendered] ./templates/bar.js 38 bytes [optional] [built] [code generated] [exports: default] [used exports unknown] - context element ./bar ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar - context element ./bar.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar.js + import() context element ./bar ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar + import() context element ./bar.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar.js chunk (runtime: main) 544.output.js 38 bytes [rendered] > ./baz ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz > ./baz.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz.js ./templates/baz.js 38 bytes [optional] [built] [code generated] [exports: default] [used exports unknown] - context element ./baz ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz - context element ./baz.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz.js + import() context element ./baz ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz + import() context element ./baz.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz.js chunk (runtime: main) 718.output.js 38 bytes [rendered] > ./foo ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo > ./foo.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo.js ./templates/foo.js 38 bytes [optional] [built] [code generated] [exports: default] [used exports unknown] - context element ./foo ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo - context element ./foo.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo.js -webpack 5.11.1 compiled successfully + import() context element ./foo ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo + import() context element ./foo.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo.js +webpack 5.51.1 compiled successfully ``` ## Production mode ``` -asset output.js 2.47 KiB [emitted] [minimized] (name: main) +asset output.js 2.48 KiB [emitted] [minimized] (name: main) asset 398.output.js 130 bytes [emitted] [minimized] asset 544.output.js 130 bytes [emitted] [minimized] asset 718.output.js 130 bytes [emitted] [minimized] @@ -432,21 +429,21 @@ chunk (runtime: main) 398.output.js 38 bytes [rendered] > ./bar.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar.js ./templates/bar.js 38 bytes [optional] [built] [code generated] [exports: default] - context element ./bar ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar - context element ./bar.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar.js + import() context element ./bar ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar + import() context element ./bar.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar.js chunk (runtime: main) 544.output.js 38 bytes [rendered] > ./baz ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz > ./baz.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz.js ./templates/baz.js 38 bytes [optional] [built] [code generated] [exports: default] - context element ./baz ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz - context element ./baz.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz.js + import() context element ./baz ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz + import() context element ./baz.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz.js chunk (runtime: main) 718.output.js 38 bytes [rendered] > ./foo ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo > ./foo.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo.js ./templates/foo.js 38 bytes [optional] [built] [code generated] [exports: default] - context element ./foo ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo - context element ./foo.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo.js -webpack 5.11.1 compiled successfully + import() context element ./foo ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo + import() context element ./foo.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo.js +webpack 5.51.1 compiled successfully ``` diff --git a/examples/code-splitting-native-import-context/README.md b/examples/code-splitting-native-import-context/README.md index e530c9b9dd0..77906615fb7 100644 --- a/examples/code-splitting-native-import-context/README.md +++ b/examples/code-splitting-native-import-context/README.md @@ -87,7 +87,7 @@ function webpackAsyncContext(req) { return __webpack_require__(id); }); } -webpackAsyncContext.keys = () => Object.keys(map); +webpackAsyncContext.keys = () => (Object.keys(map)); webpackAsyncContext.id = 1; module.exports = webpackAsyncContext; @@ -105,8 +105,9 @@ module.exports = webpackAsyncContext; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -162,7 +163,7 @@ module.exports = webpackAsyncContext; /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop) +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/load script */ @@ -170,7 +171,7 @@ module.exports = webpackAsyncContext; /******/ var inProgress = {}; /******/ // data-webpack is not used as build has no uniqueName /******/ // loadScript function to load a script via script tag -/******/ __webpack_require__.l = (url, done, key) => { +/******/ __webpack_require__.l = (url, done, key, chunkId) => { /******/ if(inProgress[url]) { inProgress[url].push(done); return; } /******/ var script, needAttach; /******/ if(key !== undefined) { @@ -200,7 +201,7 @@ module.exports = webpackAsyncContext; /******/ var doneFns = inProgress[url]; /******/ delete inProgress[url]; /******/ script.parentNode && script.parentNode.removeChild(script); -/******/ doneFns && doneFns.forEach((fn) => fn(event)); +/******/ doneFns && doneFns.forEach((fn) => (fn(event))); /******/ if(prev) return prev(event); /******/ } /******/ ; @@ -233,12 +234,11 @@ module.exports = webpackAsyncContext; /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched -/******/ // Promise = chunk loading, 0 = chunk loaded +/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 179: 0 /******/ }; /******/ -/******/ /******/ __webpack_require__.f.j = (chunkId, promises) => { /******/ // JSONP chunk loading for javascript /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined; @@ -250,9 +250,7 @@ module.exports = webpackAsyncContext; /******/ } else { /******/ if(true) { // all chunks have JS /******/ // setup Promise in chunk cache -/******/ var promise = new Promise((resolve, reject) => { -/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; -/******/ }); +/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject])); /******/ promises.push(installedChunkData[2] = promise); /******/ /******/ // start chunk loading @@ -274,7 +272,7 @@ module.exports = webpackAsyncContext; /******/ } /******/ } /******/ }; -/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId); +/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId); /******/ } else installedChunks[chunkId] = 0; /******/ } /******/ } @@ -288,30 +286,29 @@ module.exports = webpackAsyncContext; /******/ /******/ // no HMR manifest /******/ -/******/ // no deferred startup +/******/ // no on chunks loaded /******/ /******/ // install a JSONP callback for chunk loading /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { /******/ var [chunkIds, moreModules, runtime] = data; /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, resolves = []; +/******/ var moduleId, chunkId, i = 0; +/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { +/******/ for(moduleId in moreModules) { +/******/ if(__webpack_require__.o(moreModules, moduleId)) { +/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(runtime) var result = runtime(__webpack_require__); +/******/ } +/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); /******/ for(;i < chunkIds.length; i++) { /******/ chunkId = chunkIds[i]; /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { -/******/ resolves.push(installedChunks[chunkId][0]); +/******/ installedChunks[chunkId][0](); /******/ } -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ for(moduleId in moreModules) { -/******/ if(__webpack_require__.o(moreModules, moduleId)) { -/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; -/******/ } -/******/ } -/******/ if(runtime) runtime(__webpack_require__); -/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); -/******/ while(resolves.length) { -/******/ resolves.shift()(); +/******/ installedChunks[chunkIds[i]] = 0; /******/ } /******/ /******/ } @@ -319,8 +316,6 @@ module.exports = webpackAsyncContext; /******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || []; /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); -/******/ -/******/ // no deferred startup /******/ })(); /******/ /************************************************************************/ @@ -329,6 +324,8 @@ module.exports = webpackAsyncContext; ``` js +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { /*!********************!*\ !*** ./example.js ***! @@ -362,10 +359,10 @@ getTemplate("baz"); ## Unoptimized ``` -asset output.js 10.9 KiB [emitted] (name: main) -asset 398.output.js 856 bytes [emitted] -asset 544.output.js 856 bytes [emitted] -asset 718.output.js 856 bytes [emitted] +asset output.js 11 KiB [emitted] (name: main) +asset 398.output.js 858 bytes [emitted] +asset 544.output.js 858 bytes [emitted] +asset 718.output.js 858 bytes [emitted] chunk (runtime: main) output.js (main) 441 bytes (javascript) 5.54 KiB (runtime) [entry] [rendered] > ./example.js main runtime modules 5.54 KiB 8 modules @@ -379,31 +376,31 @@ chunk (runtime: main) 398.output.js 38 bytes [rendered] ./templates/bar.js 38 bytes [optional] [built] [code generated] [exports: default] [used exports unknown] - context element ./bar ./templates/ lazy ^\.\/.*$ namespace object ./bar - context element ./bar.js ./templates/ lazy ^\.\/.*$ namespace object ./bar.js + import() context element ./bar ./templates/ lazy ^\.\/.*$ namespace object ./bar + import() context element ./bar.js ./templates/ lazy ^\.\/.*$ namespace object ./bar.js chunk (runtime: main) 544.output.js 38 bytes [rendered] > ./baz ./templates/ lazy ^\.\/.*$ namespace object ./baz > ./baz.js ./templates/ lazy ^\.\/.*$ namespace object ./baz.js ./templates/baz.js 38 bytes [optional] [built] [code generated] [exports: default] [used exports unknown] - context element ./baz ./templates/ lazy ^\.\/.*$ namespace object ./baz - context element ./baz.js ./templates/ lazy ^\.\/.*$ namespace object ./baz.js + import() context element ./baz ./templates/ lazy ^\.\/.*$ namespace object ./baz + import() context element ./baz.js ./templates/ lazy ^\.\/.*$ namespace object ./baz.js chunk (runtime: main) 718.output.js 38 bytes [rendered] > ./foo ./templates/ lazy ^\.\/.*$ namespace object ./foo > ./foo.js ./templates/ lazy ^\.\/.*$ namespace object ./foo.js ./templates/foo.js 38 bytes [optional] [built] [code generated] [exports: default] [used exports unknown] - context element ./foo ./templates/ lazy ^\.\/.*$ namespace object ./foo - context element ./foo.js ./templates/ lazy ^\.\/.*$ namespace object ./foo.js -webpack 5.11.1 compiled successfully + import() context element ./foo ./templates/ lazy ^\.\/.*$ namespace object ./foo + import() context element ./foo.js ./templates/ lazy ^\.\/.*$ namespace object ./foo.js +webpack 5.51.1 compiled successfully ``` ## Production mode ``` -asset output.js 2.43 KiB [emitted] [minimized] (name: main) +asset output.js 2.44 KiB [emitted] [minimized] (name: main) asset 398.output.js 130 bytes [emitted] [minimized] asset 544.output.js 130 bytes [emitted] [minimized] asset 718.output.js 130 bytes [emitted] [minimized] @@ -419,21 +416,21 @@ chunk (runtime: main) 398.output.js 38 bytes [rendered] > ./bar.js ./templates/ lazy ^\.\/.*$ namespace object ./bar.js ./templates/bar.js 38 bytes [optional] [built] [code generated] [exports: default] - context element ./bar ./templates/ lazy ^\.\/.*$ namespace object ./bar - context element ./bar.js ./templates/ lazy ^\.\/.*$ namespace object ./bar.js + import() context element ./bar ./templates/ lazy ^\.\/.*$ namespace object ./bar + import() context element ./bar.js ./templates/ lazy ^\.\/.*$ namespace object ./bar.js chunk (runtime: main) 544.output.js 38 bytes [rendered] > ./baz ./templates/ lazy ^\.\/.*$ namespace object ./baz > ./baz.js ./templates/ lazy ^\.\/.*$ namespace object ./baz.js ./templates/baz.js 38 bytes [optional] [built] [code generated] [exports: default] - context element ./baz ./templates/ lazy ^\.\/.*$ namespace object ./baz - context element ./baz.js ./templates/ lazy ^\.\/.*$ namespace object ./baz.js + import() context element ./baz ./templates/ lazy ^\.\/.*$ namespace object ./baz + import() context element ./baz.js ./templates/ lazy ^\.\/.*$ namespace object ./baz.js chunk (runtime: main) 718.output.js 38 bytes [rendered] > ./foo ./templates/ lazy ^\.\/.*$ namespace object ./foo > ./foo.js ./templates/ lazy ^\.\/.*$ namespace object ./foo.js ./templates/foo.js 38 bytes [optional] [built] [code generated] [exports: default] - context element ./foo ./templates/ lazy ^\.\/.*$ namespace object ./foo - context element ./foo.js ./templates/ lazy ^\.\/.*$ namespace object ./foo.js -webpack 5.11.1 compiled successfully + import() context element ./foo ./templates/ lazy ^\.\/.*$ namespace object ./foo + import() context element ./foo.js ./templates/ lazy ^\.\/.*$ namespace object ./foo.js +webpack 5.51.1 compiled successfully ``` diff --git a/examples/code-splitting-specify-chunk-name/README.md b/examples/code-splitting-specify-chunk-name/README.md index a14fb23cdc8..cb380d3de04 100644 --- a/examples/code-splitting-specify-chunk-name/README.md +++ b/examples/code-splitting-specify-chunk-name/README.md @@ -79,7 +79,7 @@ function webpackAsyncContext(req) { return __webpack_require__(id); }); } -webpackAsyncContext.keys = () => Object.keys(map); +webpackAsyncContext.keys = () => (Object.keys(map)); webpackAsyncContext.id = 1; module.exports = webpackAsyncContext; @@ -97,8 +97,9 @@ module.exports = webpackAsyncContext; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -154,7 +155,7 @@ module.exports = webpackAsyncContext; /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop) +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/load script */ @@ -162,7 +163,7 @@ module.exports = webpackAsyncContext; /******/ var inProgress = {}; /******/ // data-webpack is not used as build has no uniqueName /******/ // loadScript function to load a script via script tag -/******/ __webpack_require__.l = (url, done, key) => { +/******/ __webpack_require__.l = (url, done, key, chunkId) => { /******/ if(inProgress[url]) { inProgress[url].push(done); return; } /******/ var script, needAttach; /******/ if(key !== undefined) { @@ -192,7 +193,7 @@ module.exports = webpackAsyncContext; /******/ var doneFns = inProgress[url]; /******/ delete inProgress[url]; /******/ script.parentNode && script.parentNode.removeChild(script); -/******/ doneFns && doneFns.forEach((fn) => fn(event)); +/******/ doneFns && doneFns.forEach((fn) => (fn(event))); /******/ if(prev) return prev(event); /******/ } /******/ ; @@ -225,12 +226,11 @@ module.exports = webpackAsyncContext; /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched -/******/ // Promise = chunk loading, 0 = chunk loaded +/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 179: 0 /******/ }; /******/ -/******/ /******/ __webpack_require__.f.j = (chunkId, promises) => { /******/ // JSONP chunk loading for javascript /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined; @@ -242,9 +242,7 @@ module.exports = webpackAsyncContext; /******/ } else { /******/ if(true) { // all chunks have JS /******/ // setup Promise in chunk cache -/******/ var promise = new Promise((resolve, reject) => { -/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; -/******/ }); +/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject])); /******/ promises.push(installedChunkData[2] = promise); /******/ /******/ // start chunk loading @@ -266,7 +264,7 @@ module.exports = webpackAsyncContext; /******/ } /******/ } /******/ }; -/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId); +/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId); /******/ } else installedChunks[chunkId] = 0; /******/ } /******/ } @@ -280,30 +278,29 @@ module.exports = webpackAsyncContext; /******/ /******/ // no HMR manifest /******/ -/******/ // no deferred startup +/******/ // no on chunks loaded /******/ /******/ // install a JSONP callback for chunk loading /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { /******/ var [chunkIds, moreModules, runtime] = data; /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, resolves = []; +/******/ var moduleId, chunkId, i = 0; +/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { +/******/ for(moduleId in moreModules) { +/******/ if(__webpack_require__.o(moreModules, moduleId)) { +/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(runtime) var result = runtime(__webpack_require__); +/******/ } +/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); /******/ for(;i < chunkIds.length; i++) { /******/ chunkId = chunkIds[i]; /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { -/******/ resolves.push(installedChunks[chunkId][0]); +/******/ installedChunks[chunkId][0](); /******/ } -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ for(moduleId in moreModules) { -/******/ if(__webpack_require__.o(moreModules, moduleId)) { -/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; -/******/ } -/******/ } -/******/ if(runtime) runtime(__webpack_require__); -/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); -/******/ while(resolves.length) { -/******/ resolves.shift()(); +/******/ installedChunks[chunkIds[i]] = 0; /******/ } /******/ /******/ } @@ -311,8 +308,6 @@ module.exports = webpackAsyncContext; /******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || []; /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); -/******/ -/******/ // no deferred startup /******/ })(); /******/ /************************************************************************/ @@ -321,6 +316,8 @@ module.exports = webpackAsyncContext; ``` js +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { /*!********************!*\ !*** ./example.js ***! @@ -354,10 +351,10 @@ __webpack_require__(1)("./ba" + createContextVar).then(function(bar) { ## Unoptimized ``` -asset output.js 11.2 KiB [emitted] (name: main) -asset 548.output.js 856 bytes [emitted] (name: chunk-bar-baz2) -asset 791.output.js 856 bytes [emitted] (name: chunk-bar-baz0) -asset 930.output.js 856 bytes [emitted] (name: chunk-foo) +asset output.js 11.3 KiB [emitted] (name: main) +asset 548.output.js 858 bytes [emitted] (name: chunk-bar-baz2) +asset 791.output.js 858 bytes [emitted] (name: chunk-bar-baz0) +asset 930.output.js 858 bytes [emitted] (name: chunk-foo) chunk (runtime: main) output.js (main) 565 bytes (javascript) 5.54 KiB (runtime) [entry] [rendered] > ./example.js main runtime modules 5.54 KiB 8 modules @@ -371,16 +368,16 @@ chunk (runtime: main) 548.output.js (chunk-bar-baz2) 38 bytes [rendered] ./templates/baz.js 38 bytes [optional] [built] [code generated] [exports: default] [used exports unknown] - context element ./baz ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz - context element ./baz.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz.js + import() context element ./baz ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz + import() context element ./baz.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz.js chunk (runtime: main) 791.output.js (chunk-bar-baz0) 38 bytes [rendered] > ./bar ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar > ./bar.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar.js ./templates/bar.js 38 bytes [optional] [built] [code generated] [exports: default] [used exports unknown] - context element ./bar ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar - context element ./bar.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar.js + import() context element ./bar ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar + import() context element ./bar.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar.js chunk (runtime: main) 930.output.js (chunk-foo) 38 bytes [rendered] > ./templates/foo ./example.js 1:0-62 > ./example.js 5:0-8:16 @@ -389,13 +386,13 @@ chunk (runtime: main) 930.output.js (chunk-foo) 38 bytes [rendered] [used exports unknown] import() ./templates/foo ./example.js 1:0-62 cjs require ./templates/foo ./example.js 6:11-37 -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` ## Production mode ``` -asset output.js 2.44 KiB [emitted] [minimized] (name: main) +asset output.js 2.45 KiB [emitted] [minimized] (name: main) asset 548.output.js 130 bytes [emitted] [minimized] (name: chunk-bar-baz2) asset 791.output.js 130 bytes [emitted] [minimized] (name: chunk-bar-baz0) asset 930.output.js 130 bytes [emitted] [minimized] (name: chunk-foo) @@ -411,15 +408,15 @@ chunk (runtime: main) 548.output.js (chunk-bar-baz2) 38 bytes [rendered] > ./baz.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz.js ./templates/baz.js 38 bytes [optional] [built] [code generated] [exports: default] - context element ./baz ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz - context element ./baz.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz.js + import() context element ./baz ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz + import() context element ./baz.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz.js chunk (runtime: main) 791.output.js (chunk-bar-baz0) 38 bytes [rendered] > ./bar ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar > ./bar.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar.js ./templates/bar.js 38 bytes [optional] [built] [code generated] [exports: default] - context element ./bar ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar - context element ./bar.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar.js + import() context element ./bar ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar + import() context element ./bar.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar.js chunk (runtime: main) 930.output.js (chunk-foo) 38 bytes [rendered] > ./templates/foo ./example.js 1:0-62 > ./example.js 5:0-8:16 @@ -427,5 +424,5 @@ chunk (runtime: main) 930.output.js (chunk-foo) 38 bytes [rendered] [exports: default] import() ./templates/foo ./example.js 1:0-62 cjs require ./templates/foo ./example.js 6:11-37 -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` diff --git a/examples/code-splitting/README.md b/examples/code-splitting/README.md index d1391a9375b..415508936d3 100644 --- a/examples/code-splitting/README.md +++ b/examples/code-splitting/README.md @@ -75,8 +75,9 @@ require.ensure(["c"], function(require) { /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -120,7 +121,7 @@ require.ensure(["c"], function(require) { /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop) +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/load script */ @@ -128,7 +129,7 @@ require.ensure(["c"], function(require) { /******/ var inProgress = {}; /******/ // data-webpack is not used as build has no uniqueName /******/ // loadScript function to load a script via script tag -/******/ __webpack_require__.l = (url, done, key) => { +/******/ __webpack_require__.l = (url, done, key, chunkId) => { /******/ if(inProgress[url]) { inProgress[url].push(done); return; } /******/ var script, needAttach; /******/ if(key !== undefined) { @@ -158,7 +159,7 @@ require.ensure(["c"], function(require) { /******/ var doneFns = inProgress[url]; /******/ delete inProgress[url]; /******/ script.parentNode && script.parentNode.removeChild(script); -/******/ doneFns && doneFns.forEach((fn) => fn(event)); +/******/ doneFns && doneFns.forEach((fn) => (fn(event))); /******/ if(prev) return prev(event); /******/ } /******/ ; @@ -180,12 +181,11 @@ require.ensure(["c"], function(require) { /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched -/******/ // Promise = chunk loading, 0 = chunk loaded +/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 179: 0 /******/ }; /******/ -/******/ /******/ __webpack_require__.f.j = (chunkId, promises) => { /******/ // JSONP chunk loading for javascript /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined; @@ -197,9 +197,7 @@ require.ensure(["c"], function(require) { /******/ } else { /******/ if(true) { // all chunks have JS /******/ // setup Promise in chunk cache -/******/ var promise = new Promise((resolve, reject) => { -/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; -/******/ }); +/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject])); /******/ promises.push(installedChunkData[2] = promise); /******/ /******/ // start chunk loading @@ -221,7 +219,7 @@ require.ensure(["c"], function(require) { /******/ } /******/ } /******/ }; -/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId); +/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId); /******/ } else installedChunks[chunkId] = 0; /******/ } /******/ } @@ -235,30 +233,29 @@ require.ensure(["c"], function(require) { /******/ /******/ // no HMR manifest /******/ -/******/ // no deferred startup +/******/ // no on chunks loaded /******/ /******/ // install a JSONP callback for chunk loading /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { /******/ var [chunkIds, moreModules, runtime] = data; /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, resolves = []; +/******/ var moduleId, chunkId, i = 0; +/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { +/******/ for(moduleId in moreModules) { +/******/ if(__webpack_require__.o(moreModules, moduleId)) { +/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(runtime) var result = runtime(__webpack_require__); +/******/ } +/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); /******/ for(;i < chunkIds.length; i++) { /******/ chunkId = chunkIds[i]; /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { -/******/ resolves.push(installedChunks[chunkId][0]); +/******/ installedChunks[chunkId][0](); /******/ } -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ for(moduleId in moreModules) { -/******/ if(__webpack_require__.o(moreModules, moduleId)) { -/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; -/******/ } -/******/ } -/******/ if(runtime) runtime(__webpack_require__); -/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); -/******/ while(resolves.length) { -/******/ resolves.shift()(); +/******/ installedChunks[chunkIds[i]] = 0; /******/ } /******/ /******/ } @@ -266,8 +263,6 @@ require.ensure(["c"], function(require) { /******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || []; /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); -/******/ -/******/ // no deferred startup /******/ })(); /******/ /************************************************************************/ @@ -276,6 +271,8 @@ require.ensure(["c"], function(require) { ``` js +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { /*!********************!*\ !*** ./example.js ***! @@ -337,11 +334,11 @@ Minimized ## Unoptimized ``` -asset output.js 9.37 KiB [emitted] (name: main) +asset output.js 9.49 KiB [emitted] (name: main) asset 796.output.js 528 bytes [emitted] -chunk (runtime: main) output.js (main) 161 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 161 bytes (javascript) 4.98 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 4.97 KiB 6 modules + runtime modules 4.98 KiB 6 modules dependent modules 22 bytes [dependent] 2 modules ./example.js 139 bytes [built] [code generated] [used exports unknown] @@ -354,7 +351,7 @@ chunk (runtime: main) 796.output.js 22 bytes [rendered] ./node_modules/d.js 11 bytes [built] [code generated] [used exports unknown] cjs require d ./example.js 5:12-24 -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` ## Production mode @@ -362,9 +359,9 @@ webpack 5.11.1 compiled successfully ``` asset output.js 1.74 KiB [emitted] [minimized] (name: main) asset 796.output.js 80 bytes [emitted] [minimized] -chunk (runtime: main) output.js (main) 161 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 161 bytes (javascript) 4.98 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 4.97 KiB 6 modules + runtime modules 4.98 KiB 6 modules dependent modules 22 bytes [dependent] 2 modules ./example.js 139 bytes [built] [code generated] [no exports used] @@ -377,5 +374,5 @@ chunk (runtime: main) 796.output.js 22 bytes [rendered] ./node_modules/d.js 11 bytes [built] [code generated] [used exports unknown] cjs require d ./example.js 5:12-24 -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` diff --git a/examples/coffee-script/README.md b/examples/coffee-script/README.md index 270fea3e54c..32ea65462f7 100644 --- a/examples/coffee-script/README.md +++ b/examples/coffee-script/README.md @@ -74,8 +74,9 @@ module.exports = 42; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -97,6 +98,8 @@ module.exports = 42; ``` js +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { /*!********************!*\ !*** ./example.js ***! @@ -115,25 +118,25 @@ console.log(__webpack_require__(/*! ./cup1 */ 1)); ## Unoptimized ``` -asset output.js 2.09 KiB [emitted] (name: main) +asset output.js 2.27 KiB [emitted] (name: main) chunk (runtime: main) output.js (main) 206 bytes [entry] [rendered] > ./example.js main dependent modules 175 bytes [dependent] 2 modules ./example.js 31 bytes [built] [code generated] [used exports unknown] entry ./example.js main -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` ## Production mode ``` -asset output.js 280 bytes [emitted] [minimized] (name: main) +asset output.js 294 bytes [emitted] [minimized] (name: main) chunk (runtime: main) output.js (main) 206 bytes [entry] [rendered] > ./example.js main dependent modules 175 bytes [dependent] 2 modules ./example.js 31 bytes [built] [code generated] [no exports used] entry ./example.js main -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` diff --git a/examples/common-chunk-and-vendor-chunk/README.md b/examples/common-chunk-and-vendor-chunk/README.md index 8434b15379f..637e67e798f 100644 --- a/examples/common-chunk-and-vendor-chunk/README.md +++ b/examples/common-chunk-and-vendor-chunk/README.md @@ -194,8 +194,9 @@ module.exports = "utility1"; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -214,13 +215,42 @@ module.exports = "utility1"; /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = __webpack_modules__; /******/ -/******/ // the startup function -/******/ // It's empty as some runtime module handles the default behavior -/******/ __webpack_require__.x = x => {} /************************************************************************/ +/******/ /* webpack/runtime/chunk loaded */ +/******/ (() => { +/******/ var deferred = []; +/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => { +/******/ if(chunkIds) { +/******/ priority = priority || 0; +/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; +/******/ deferred[i] = [chunkIds, fn, priority]; +/******/ return; +/******/ } +/******/ var notFulfilled = Infinity; +/******/ for (var i = 0; i < deferred.length; i++) { +/******/ var [chunkIds, fn, priority] = deferred[i]; +/******/ var fulfilled = true; +/******/ for (var j = 0; j < chunkIds.length; j++) { +/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) { +/******/ chunkIds.splice(j--, 1); +/******/ } else { +/******/ fulfilled = false; +/******/ if(priority < notFulfilled) notFulfilled = priority; +/******/ } +/******/ } +/******/ if(fulfilled) { +/******/ deferred.splice(i--, 1) +/******/ var r = fn(); +/******/ if (r !== undefined) result = r; +/******/ } +/******/ } +/******/ return result; +/******/ }; +/******/ })(); +/******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop) +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/jsonp chunk loading */ @@ -229,14 +259,11 @@ module.exports = "utility1"; /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched -/******/ // Promise = chunk loading, 0 = chunk loaded +/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ "pageA": 0 /******/ }; /******/ -/******/ var deferredModules = [ -/******/ [0,"vendor","commons-utility2_js"] -/******/ ]; /******/ // no chunk on demand loading /******/ /******/ // no prefetching @@ -247,69 +274,36 @@ module.exports = "utility1"; /******/ /******/ // no HMR manifest /******/ -/******/ var checkDeferredModules = x => {}; +/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0); /******/ /******/ // install a JSONP callback for chunk loading /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { -/******/ var [chunkIds, moreModules, runtime, executeModules] = data; +/******/ var [chunkIds, moreModules, runtime] = data; /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, resolves = []; +/******/ var moduleId, chunkId, i = 0; +/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { +/******/ for(moduleId in moreModules) { +/******/ if(__webpack_require__.o(moreModules, moduleId)) { +/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(runtime) var result = runtime(__webpack_require__); +/******/ } +/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); /******/ for(;i < chunkIds.length; i++) { /******/ chunkId = chunkIds[i]; /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { -/******/ resolves.push(installedChunks[chunkId][0]); -/******/ } -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ for(moduleId in moreModules) { -/******/ if(__webpack_require__.o(moreModules, moduleId)) { -/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ installedChunks[chunkId][0](); /******/ } +/******/ installedChunks[chunkIds[i]] = 0; /******/ } -/******/ if(runtime) runtime(__webpack_require__); -/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); -/******/ while(resolves.length) { -/******/ resolves.shift()(); -/******/ } -/******/ -/******/ // add entry modules from loaded chunk to deferred list -/******/ if(executeModules) deferredModules.push.apply(deferredModules, executeModules); -/******/ -/******/ // run deferred modules when all chunks ready -/******/ return checkDeferredModules(); +/******/ return __webpack_require__.O(result); /******/ } /******/ /******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || []; /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); -/******/ -/******/ function checkDeferredModulesImpl() { -/******/ var result; -/******/ for(var i = 0; i < deferredModules.length; i++) { -/******/ var deferredModule = deferredModules[i]; -/******/ var fulfilled = true; -/******/ for(var j = 1; j < deferredModule.length; j++) { -/******/ var depId = deferredModule[j]; -/******/ if(installedChunks[depId] !== 0) fulfilled = false; -/******/ } -/******/ if(fulfilled) { -/******/ deferredModules.splice(i--, 1); -/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]); -/******/ } -/******/ } -/******/ if(deferredModules.length === 0) { -/******/ __webpack_require__.x(); -/******/ __webpack_require__.x = x => {}; -/******/ } -/******/ return result; -/******/ } -/******/ var startup = __webpack_require__.x; -/******/ __webpack_require__.x = () => { -/******/ // reset startup function so it can be called again when more startup code is added -/******/ __webpack_require__.x = startup || (x => {}); -/******/ return (checkDeferredModules = checkDeferredModulesImpl)(); -/******/ }; /******/ })(); /******/ /************************************************************************/ @@ -318,8 +312,13 @@ module.exports = "utility1"; ``` js -/******/ // run startup -/******/ return __webpack_require__.x(); +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module depends on other loaded chunks and execution need to be delayed +/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["vendor","commons-utility2_js"], () => (__webpack_require__(0))) +/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); +/******/ /******/ })() ; ``` @@ -361,8 +360,9 @@ module.exports = "pageB"; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -381,13 +381,42 @@ module.exports = "pageB"; /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = __webpack_modules__; /******/ -/******/ // the startup function -/******/ // It's empty as some runtime module handles the default behavior -/******/ __webpack_require__.x = x => {} /************************************************************************/ +/******/ /* webpack/runtime/chunk loaded */ +/******/ (() => { +/******/ var deferred = []; +/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => { +/******/ if(chunkIds) { +/******/ priority = priority || 0; +/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; +/******/ deferred[i] = [chunkIds, fn, priority]; +/******/ return; +/******/ } +/******/ var notFulfilled = Infinity; +/******/ for (var i = 0; i < deferred.length; i++) { +/******/ var [chunkIds, fn, priority] = deferred[i]; +/******/ var fulfilled = true; +/******/ for (var j = 0; j < chunkIds.length; j++) { +/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) { +/******/ chunkIds.splice(j--, 1); +/******/ } else { +/******/ fulfilled = false; +/******/ if(priority < notFulfilled) notFulfilled = priority; +/******/ } +/******/ } +/******/ if(fulfilled) { +/******/ deferred.splice(i--, 1) +/******/ var r = fn(); +/******/ if (r !== undefined) result = r; +/******/ } +/******/ } +/******/ return result; +/******/ }; +/******/ })(); +/******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop) +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/jsonp chunk loading */ @@ -396,14 +425,11 @@ module.exports = "pageB"; /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched -/******/ // Promise = chunk loading, 0 = chunk loaded +/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ "pageB": 0 /******/ }; /******/ -/******/ var deferredModules = [ -/******/ [4,"vendor","commons-utility2_js","commons-utility3_js"] -/******/ ]; /******/ // no chunk on demand loading /******/ /******/ // no prefetching @@ -414,69 +440,36 @@ module.exports = "pageB"; /******/ /******/ // no HMR manifest /******/ -/******/ var checkDeferredModules = x => {}; +/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0); /******/ /******/ // install a JSONP callback for chunk loading /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { -/******/ var [chunkIds, moreModules, runtime, executeModules] = data; +/******/ var [chunkIds, moreModules, runtime] = data; /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, resolves = []; +/******/ var moduleId, chunkId, i = 0; +/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { +/******/ for(moduleId in moreModules) { +/******/ if(__webpack_require__.o(moreModules, moduleId)) { +/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(runtime) var result = runtime(__webpack_require__); +/******/ } +/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); /******/ for(;i < chunkIds.length; i++) { /******/ chunkId = chunkIds[i]; /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { -/******/ resolves.push(installedChunks[chunkId][0]); -/******/ } -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ for(moduleId in moreModules) { -/******/ if(__webpack_require__.o(moreModules, moduleId)) { -/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ installedChunks[chunkId][0](); /******/ } +/******/ installedChunks[chunkIds[i]] = 0; /******/ } -/******/ if(runtime) runtime(__webpack_require__); -/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); -/******/ while(resolves.length) { -/******/ resolves.shift()(); -/******/ } -/******/ -/******/ // add entry modules from loaded chunk to deferred list -/******/ if(executeModules) deferredModules.push.apply(deferredModules, executeModules); -/******/ -/******/ // run deferred modules when all chunks ready -/******/ return checkDeferredModules(); +/******/ return __webpack_require__.O(result); /******/ } /******/ /******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || []; /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); -/******/ -/******/ function checkDeferredModulesImpl() { -/******/ var result; -/******/ for(var i = 0; i < deferredModules.length; i++) { -/******/ var deferredModule = deferredModules[i]; -/******/ var fulfilled = true; -/******/ for(var j = 1; j < deferredModule.length; j++) { -/******/ var depId = deferredModule[j]; -/******/ if(installedChunks[depId] !== 0) fulfilled = false; -/******/ } -/******/ if(fulfilled) { -/******/ deferredModules.splice(i--, 1); -/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]); -/******/ } -/******/ } -/******/ if(deferredModules.length === 0) { -/******/ __webpack_require__.x(); -/******/ __webpack_require__.x = x => {}; -/******/ } -/******/ return result; -/******/ } -/******/ var startup = __webpack_require__.x; -/******/ __webpack_require__.x = () => { -/******/ // reset startup function so it can be called again when more startup code is added -/******/ __webpack_require__.x = startup || (x => {}); -/******/ return (checkDeferredModules = checkDeferredModulesImpl)(); -/******/ }; /******/ })(); /******/ /************************************************************************/ @@ -485,8 +478,13 @@ module.exports = "pageB"; ``` js -/******/ // run startup -/******/ return __webpack_require__.x(); +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module depends on other loaded chunks and execution need to be delayed +/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["vendor","commons-utility2_js","commons-utility3_js"], () => (__webpack_require__(4))) +/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); +/******/ /******/ })() ; ``` @@ -526,8 +524,9 @@ module.exports = "pageC"; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -546,13 +545,42 @@ module.exports = "pageC"; /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = __webpack_modules__; /******/ -/******/ // the startup function -/******/ // It's empty as some runtime module handles the default behavior -/******/ __webpack_require__.x = x => {} /************************************************************************/ +/******/ /* webpack/runtime/chunk loaded */ +/******/ (() => { +/******/ var deferred = []; +/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => { +/******/ if(chunkIds) { +/******/ priority = priority || 0; +/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; +/******/ deferred[i] = [chunkIds, fn, priority]; +/******/ return; +/******/ } +/******/ var notFulfilled = Infinity; +/******/ for (var i = 0; i < deferred.length; i++) { +/******/ var [chunkIds, fn, priority] = deferred[i]; +/******/ var fulfilled = true; +/******/ for (var j = 0; j < chunkIds.length; j++) { +/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) { +/******/ chunkIds.splice(j--, 1); +/******/ } else { +/******/ fulfilled = false; +/******/ if(priority < notFulfilled) notFulfilled = priority; +/******/ } +/******/ } +/******/ if(fulfilled) { +/******/ deferred.splice(i--, 1) +/******/ var r = fn(); +/******/ if (r !== undefined) result = r; +/******/ } +/******/ } +/******/ return result; +/******/ }; +/******/ })(); +/******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop) +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/jsonp chunk loading */ @@ -561,14 +589,11 @@ module.exports = "pageC"; /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched -/******/ // Promise = chunk loading, 0 = chunk loaded +/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ "pageC": 0 /******/ }; /******/ -/******/ var deferredModules = [ -/******/ [7,"commons-utility2_js","commons-utility3_js"] -/******/ ]; /******/ // no chunk on demand loading /******/ /******/ // no prefetching @@ -579,69 +604,36 @@ module.exports = "pageC"; /******/ /******/ // no HMR manifest /******/ -/******/ var checkDeferredModules = x => {}; +/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0); /******/ /******/ // install a JSONP callback for chunk loading /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { -/******/ var [chunkIds, moreModules, runtime, executeModules] = data; +/******/ var [chunkIds, moreModules, runtime] = data; /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, resolves = []; +/******/ var moduleId, chunkId, i = 0; +/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { +/******/ for(moduleId in moreModules) { +/******/ if(__webpack_require__.o(moreModules, moduleId)) { +/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(runtime) var result = runtime(__webpack_require__); +/******/ } +/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); /******/ for(;i < chunkIds.length; i++) { /******/ chunkId = chunkIds[i]; /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { -/******/ resolves.push(installedChunks[chunkId][0]); +/******/ installedChunks[chunkId][0](); /******/ } -/******/ installedChunks[chunkId] = 0; +/******/ installedChunks[chunkIds[i]] = 0; /******/ } -/******/ for(moduleId in moreModules) { -/******/ if(__webpack_require__.o(moreModules, moduleId)) { -/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; -/******/ } -/******/ } -/******/ if(runtime) runtime(__webpack_require__); -/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); -/******/ while(resolves.length) { -/******/ resolves.shift()(); -/******/ } -/******/ -/******/ // add entry modules from loaded chunk to deferred list -/******/ if(executeModules) deferredModules.push.apply(deferredModules, executeModules); -/******/ -/******/ // run deferred modules when all chunks ready -/******/ return checkDeferredModules(); +/******/ return __webpack_require__.O(result); /******/ } /******/ /******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || []; /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); -/******/ -/******/ function checkDeferredModulesImpl() { -/******/ var result; -/******/ for(var i = 0; i < deferredModules.length; i++) { -/******/ var deferredModule = deferredModules[i]; -/******/ var fulfilled = true; -/******/ for(var j = 1; j < deferredModule.length; j++) { -/******/ var depId = deferredModule[j]; -/******/ if(installedChunks[depId] !== 0) fulfilled = false; -/******/ } -/******/ if(fulfilled) { -/******/ deferredModules.splice(i--, 1); -/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]); -/******/ } -/******/ } -/******/ if(deferredModules.length === 0) { -/******/ __webpack_require__.x(); -/******/ __webpack_require__.x = x => {}; -/******/ } -/******/ return result; -/******/ } -/******/ var startup = __webpack_require__.x; -/******/ __webpack_require__.x = () => { -/******/ // reset startup function so it can be called again when more startup code is added -/******/ __webpack_require__.x = startup || (x => {}); -/******/ return (checkDeferredModules = checkDeferredModulesImpl)(); -/******/ }; /******/ })(); /******/ /************************************************************************/ @@ -650,8 +642,13 @@ module.exports = "pageC"; ``` js -/******/ // run startup -/******/ return __webpack_require__.x(); +/******/ +/******/ // startup +/******/ // Load entry module and return exports +/******/ // This entry module depends on other loaded chunks and execution need to be delayed +/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["commons-utility2_js","commons-utility3_js"], () => (__webpack_require__(7))) +/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); +/******/ /******/ })() ; ``` @@ -664,13 +661,13 @@ module.exports = "pageC"; assets by chunk 768 bytes (id hint: commons) asset commons-utility2_js.js 384 bytes [emitted] (id hint: commons) asset commons-utility3_js.js 384 bytes [emitted] (id hint: commons) -asset pageA.js 6 KiB [emitted] (name: pageA) -asset pageB.js 5.73 KiB [emitted] (name: pageB) -asset pageC.js 5.67 KiB [emitted] (name: pageC) +asset pageA.js 6.08 KiB [emitted] (name: pageA) +asset pageB.js 5.8 KiB [emitted] (name: pageB) +asset pageC.js 5.74 KiB [emitted] (name: pageC) asset vendor.js 737 bytes [emitted] (name: vendor) (id hint: vendor) -Entrypoint pageA 7.09 KiB = vendor.js 737 bytes commons-utility2_js.js 384 bytes pageA.js 6 KiB -Entrypoint pageB 7.2 KiB = vendor.js 737 bytes commons-utility2_js.js 384 bytes commons-utility3_js.js 384 bytes pageB.js 5.73 KiB -Entrypoint pageC 6.42 KiB = commons-utility2_js.js 384 bytes commons-utility3_js.js 384 bytes pageC.js 5.67 KiB +Entrypoint pageA 7.17 KiB = vendor.js 737 bytes commons-utility2_js.js 384 bytes pageA.js 6.08 KiB +Entrypoint pageB 7.27 KiB = vendor.js 737 bytes commons-utility2_js.js 384 bytes commons-utility3_js.js 384 bytes pageB.js 5.8 KiB +Entrypoint pageC 6.49 KiB = commons-utility2_js.js 384 bytes commons-utility3_js.js 384 bytes pageC.js 5.74 KiB chunk (runtime: pageA, pageB, pageC) commons-utility2_js.js (id hint: commons) 28 bytes [initial] [rendered] split chunk (cache group: commons) > ./pageA pageA > ./pageB pageB @@ -689,24 +686,24 @@ chunk (runtime: pageB, pageC) commons-utility3_js.js (id hint: commons) 28 bytes cjs require ./utility3 ./pageB.js 3:15-36 cjs require ./utility3 ./pageC.js 2:15-36 cjs self exports reference ./utility3.js 1:0-14 -chunk (runtime: pageA) pageA.js (pageA) 165 bytes (javascript) 2.6 KiB (runtime) [entry] [rendered] +chunk (runtime: pageA) pageA.js (pageA) 165 bytes (javascript) 2.46 KiB (runtime) [entry] [rendered] > ./pageA pageA - runtime modules 2.6 KiB 2 modules + runtime modules 2.46 KiB 3 modules dependent modules 28 bytes [dependent] 1 module ./pageA.js 137 bytes [built] [code generated] [used exports unknown] cjs self exports reference ./pageA.js 5:0-14 entry ./pageA pageA -chunk (runtime: pageB) pageB.js (pageB) 137 bytes (javascript) 2.62 KiB (runtime) [entry] [rendered] +chunk (runtime: pageB) pageB.js (pageB) 137 bytes (javascript) 2.46 KiB (runtime) [entry] [rendered] > ./pageB pageB - runtime modules 2.62 KiB 2 modules + runtime modules 2.46 KiB 3 modules ./pageB.js 137 bytes [built] [code generated] [used exports unknown] cjs self exports reference ./pageB.js 5:0-14 entry ./pageB pageB -chunk (runtime: pageC) pageC.js (pageC) 102 bytes (javascript) 2.61 KiB (runtime) [entry] [rendered] +chunk (runtime: pageC) pageC.js (pageC) 102 bytes (javascript) 2.46 KiB (runtime) [entry] [rendered] > ./pageC pageC - runtime modules 2.61 KiB 2 modules + runtime modules 2.46 KiB 3 modules ./pageC.js 102 bytes [built] [code generated] [used exports unknown] cjs self exports reference ./pageC.js 4:0-14 @@ -722,7 +719,7 @@ chunk (runtime: pageA, pageB) vendor.js (vendor) (id hint: vendor) 54 bytes [ini [used exports unknown] cjs self exports reference ./node_modules/vendor2.js 1:0-14 cjs require vendor2 ./pageB.js 1:14-32 -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` ## Production mode @@ -731,13 +728,13 @@ webpack 5.11.1 compiled successfully assets by chunk 212 bytes (id hint: commons) asset commons-utility2_js.js 106 bytes [emitted] [minimized] (id hint: commons) asset commons-utility3_js.js 106 bytes [emitted] [minimized] (id hint: commons) -asset pageA.js 907 bytes [emitted] [minimized] (name: pageA) -asset pageB.js 899 bytes [emitted] [minimized] (name: pageB) -asset pageC.js 883 bytes [emitted] [minimized] (name: pageC) +asset pageA.js 1.01 KiB [emitted] [minimized] (name: pageA) +asset pageB.js 1 KiB [emitted] [minimized] (name: pageB) +asset pageC.js 1010 bytes [emitted] [minimized] (name: pageC) asset vendor.js 121 bytes [emitted] [minimized] (name: vendor) (id hint: vendor) -Entrypoint pageA 1.11 KiB = vendor.js 121 bytes commons-utility2_js.js 106 bytes pageA.js 907 bytes -Entrypoint pageB 1.2 KiB = vendor.js 121 bytes commons-utility2_js.js 106 bytes commons-utility3_js.js 106 bytes pageB.js 899 bytes -Entrypoint pageC 1.07 KiB = commons-utility2_js.js 106 bytes commons-utility3_js.js 106 bytes pageC.js 883 bytes +Entrypoint pageA 1.23 KiB = vendor.js 121 bytes commons-utility2_js.js 106 bytes pageA.js 1.01 KiB +Entrypoint pageB 1.33 KiB = vendor.js 121 bytes commons-utility2_js.js 106 bytes commons-utility3_js.js 106 bytes pageB.js 1 KiB +Entrypoint pageC 1.19 KiB = commons-utility2_js.js 106 bytes commons-utility3_js.js 106 bytes pageC.js 1010 bytes chunk (runtime: pageA, pageB, pageC) commons-utility2_js.js (id hint: commons) 28 bytes [initial] [rendered] split chunk (cache group: commons) > ./pageA pageA > ./pageB pageB @@ -756,24 +753,24 @@ chunk (runtime: pageB, pageC) commons-utility3_js.js (id hint: commons) 28 bytes cjs require ./utility3 ./pageB.js 3:15-36 cjs require ./utility3 ./pageC.js 2:15-36 cjs self exports reference ./utility3.js 1:0-14 -chunk (runtime: pageA) pageA.js (pageA) 165 bytes (javascript) 2.6 KiB (runtime) [entry] [rendered] +chunk (runtime: pageA) pageA.js (pageA) 165 bytes (javascript) 2.46 KiB (runtime) [entry] [rendered] > ./pageA pageA - runtime modules 2.6 KiB 2 modules + runtime modules 2.46 KiB 3 modules dependent modules 28 bytes [dependent] 1 module ./pageA.js 137 bytes [built] [code generated] [used exports unknown] cjs self exports reference ./pageA.js 5:0-14 entry ./pageA pageA -chunk (runtime: pageB) pageB.js (pageB) 137 bytes (javascript) 2.63 KiB (runtime) [entry] [rendered] +chunk (runtime: pageB) pageB.js (pageB) 137 bytes (javascript) 2.46 KiB (runtime) [entry] [rendered] > ./pageB pageB - runtime modules 2.63 KiB 2 modules + runtime modules 2.46 KiB 3 modules ./pageB.js 137 bytes [built] [code generated] [used exports unknown] cjs self exports reference ./pageB.js 5:0-14 entry ./pageB pageB -chunk (runtime: pageC) pageC.js (pageC) 102 bytes (javascript) 2.62 KiB (runtime) [entry] [rendered] +chunk (runtime: pageC) pageC.js (pageC) 102 bytes (javascript) 2.46 KiB (runtime) [entry] [rendered] > ./pageC pageC - runtime modules 2.62 KiB 2 modules + runtime modules 2.46 KiB 3 modules ./pageC.js 102 bytes [built] [code generated] [used exports unknown] cjs self exports reference ./pageC.js 4:0-14 @@ -789,5 +786,5 @@ chunk (runtime: pageA, pageB) vendor.js (vendor) (id hint: vendor) 54 bytes [ini [used exports unknown] cjs self exports reference ./node_modules/vendor2.js 1:0-14 cjs require vendor2 ./pageB.js 1:14-32 -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` diff --git a/examples/common-chunk-grandchildren/README.md b/examples/common-chunk-grandchildren/README.md index b4491f7dfcd..ec028a663ec 100644 --- a/examples/common-chunk-grandchildren/README.md +++ b/examples/common-chunk-grandchildren/README.md @@ -120,8 +120,9 @@ module.exports = { /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -165,7 +166,7 @@ module.exports = { /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop) +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/load script */ @@ -173,7 +174,7 @@ module.exports = { /******/ var inProgress = {}; /******/ // data-webpack is not used as build has no uniqueName /******/ // loadScript function to load a script via script tag -/******/ __webpack_require__.l = (url, done, key) => { +/******/ __webpack_require__.l = (url, done, key, chunkId) => { /******/ if(inProgress[url]) { inProgress[url].push(done); return; } /******/ var script, needAttach; /******/ if(key !== undefined) { @@ -203,7 +204,7 @@ module.exports = { /******/ var doneFns = inProgress[url]; /******/ delete inProgress[url]; /******/ script.parentNode && script.parentNode.removeChild(script); -/******/ doneFns && doneFns.forEach((fn) => fn(event)); +/******/ doneFns && doneFns.forEach((fn) => (fn(event))); /******/ if(prev) return prev(event); /******/ } /******/ ; @@ -225,12 +226,11 @@ module.exports = { /******/ /******/ // object to store loaded and loading chunks /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched -/******/ // Promise = chunk loading, 0 = chunk loaded +/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded /******/ var installedChunks = { /******/ 179: 0 /******/ }; /******/ -/******/ /******/ __webpack_require__.f.j = (chunkId, promises) => { /******/ // JSONP chunk loading for javascript /******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined; @@ -242,9 +242,7 @@ module.exports = { /******/ } else { /******/ if(true) { // all chunks have JS /******/ // setup Promise in chunk cache -/******/ var promise = new Promise((resolve, reject) => { -/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject]; -/******/ }); +/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject])); /******/ promises.push(installedChunkData[2] = promise); /******/ /******/ // start chunk loading @@ -266,7 +264,7 @@ module.exports = { /******/ } /******/ } /******/ }; -/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId); +/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId); /******/ } else installedChunks[chunkId] = 0; /******/ } /******/ } @@ -280,30 +278,29 @@ module.exports = { /******/ /******/ // no HMR manifest /******/ -/******/ // no deferred startup +/******/ // no on chunks loaded /******/ /******/ // install a JSONP callback for chunk loading /******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { /******/ var [chunkIds, moreModules, runtime] = data; /******/ // add "moreModules" to the modules object, /******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, resolves = []; +/******/ var moduleId, chunkId, i = 0; +/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { +/******/ for(moduleId in moreModules) { +/******/ if(__webpack_require__.o(moreModules, moduleId)) { +/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; +/******/ } +/******/ } +/******/ if(runtime) var result = runtime(__webpack_require__); +/******/ } +/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); /******/ for(;i < chunkIds.length; i++) { /******/ chunkId = chunkIds[i]; /******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { -/******/ resolves.push(installedChunks[chunkId][0]); +/******/ installedChunks[chunkId][0](); /******/ } -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ for(moduleId in moreModules) { -/******/ if(__webpack_require__.o(moreModules, moduleId)) { -/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; -/******/ } -/******/ } -/******/ if(runtime) runtime(__webpack_require__); -/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); -/******/ while(resolves.length) { -/******/ resolves.shift()(); +/******/ installedChunks[chunkIds[i]] = 0; /******/ } /******/ /******/ } @@ -311,8 +308,6 @@ module.exports = { /******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || []; /******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); /******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); -/******/ -/******/ // no deferred startup /******/ })(); /******/ /************************************************************************/ @@ -321,6 +316,7 @@ module.exports = { ``` js +var __webpack_exports__ = {}; /*!********************!*\ !*** ./example.js ***! \********************/ @@ -454,7 +450,7 @@ module.exports = function() { ## Unoptimized ``` -asset output.js 9.1 KiB [emitted] (name: main) +asset output.js 9.11 KiB [emitted] (name: main) asset 588.output.js 736 bytes [emitted] asset 366.output.js 558 bytes [emitted] asset 145.output.js 552 bytes [emitted] @@ -465,9 +461,9 @@ chunk (runtime: main) 145.output.js 136 bytes [rendered] [used exports unknown] cjs require ./pageC ./pageB.js 4:15-33 cjs self exports reference ./pageC.js 3:0-14 -chunk (runtime: main) output.js (main) 220 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 220 bytes (javascript) 4.98 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 4.97 KiB 6 modules + runtime modules 4.98 KiB 6 modules ./example.js 220 bytes [built] [code generated] [used exports unknown] entry ./example.js main @@ -491,13 +487,13 @@ chunk (runtime: main) 588.output.js 133 bytes [rendered] [used exports unknown] cjs require ./pageB ./example.js 8:15-33 cjs self exports reference ./pageB.js 1:0-14 -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` ## Production mode ``` -asset output.js 1.79 KiB [emitted] [minimized] (name: main) +asset output.js 1.8 KiB [emitted] [minimized] (name: main) asset 588.output.js 198 bytes [emitted] [minimized] asset 145.output.js 134 bytes [emitted] [minimized] asset 366.output.js 134 bytes [emitted] [minimized] @@ -508,9 +504,9 @@ chunk (runtime: main) 145.output.js 136 bytes [rendered] [used exports unknown] cjs require ./pageC ./pageB.js 4:15-33 cjs self exports reference ./pageC.js 3:0-14 -chunk (runtime: main) output.js (main) 220 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered] +chunk (runtime: main) output.js (main) 220 bytes (javascript) 4.98 KiB (runtime) [entry] [rendered] > ./example.js main - runtime modules 4.97 KiB 6 modules + runtime modules 4.98 KiB 6 modules ./example.js 220 bytes [built] [code generated] [no exports used] entry ./example.js main @@ -534,5 +530,5 @@ chunk (runtime: main) 588.output.js 133 bytes [rendered] [used exports unknown] cjs require ./pageB ./example.js 8:15-33 cjs self exports reference ./pageB.js 1:0-14 -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` diff --git a/examples/commonjs/README.md b/examples/commonjs/README.md index 06efad94f70..e8a15d44582 100644 --- a/examples/commonjs/README.md +++ b/examples/commonjs/README.md @@ -90,8 +90,9 @@ exports.add = function() { /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -113,6 +114,8 @@ exports.add = function() { ``` js +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { /*!********************!*\ !*** ./example.js ***! @@ -134,25 +137,25 @@ inc(a); // 2 ## Unoptimized ``` -asset output.js 2.34 KiB [emitted] (name: main) +asset output.js 2.51 KiB [emitted] (name: main) chunk (runtime: main) output.js (main) 326 bytes [entry] [rendered] > ./example.js main dependent modules 254 bytes [dependent] 2 modules ./example.js 72 bytes [built] [code generated] [used exports unknown] entry ./example.js main -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` ## Production mode ``` -asset output.js 296 bytes [emitted] [minimized] (name: main) +asset output.js 310 bytes [emitted] [minimized] (name: main) chunk (runtime: main) output.js (main) 326 bytes [entry] [rendered] > ./example.js main dependent modules 254 bytes [dependent] 2 modules ./example.js 72 bytes [built] [code generated] [no exports used] entry ./example.js main -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` diff --git a/examples/custom-json-modules/README.md b/examples/custom-json-modules/README.md index 113cb382c53..b710907305d 100644 --- a/examples/custom-json-modules/README.md +++ b/examples/custom-json-modules/README.md @@ -101,33 +101,7 @@ module.exports = { /******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ([ -/* 0 */ -/*!********************!*\ - !*** ./example.js ***! - \********************/ -/*! namespace exports */ -/*! exports [not provided] [no usage info] */ -/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _data_toml__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./data.toml */ 1); -/* harmony import */ var _data_yaml__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./data.yaml */ 2); -/* harmony import */ var _data_json5__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./data.json5 */ 3); - - - - -document.querySelector('#app').innerHTML = [_data_toml__WEBPACK_IMPORTED_MODULE_0__, _data_yaml__WEBPACK_IMPORTED_MODULE_1__, _data_json5__WEBPACK_IMPORTED_MODULE_2__].map(data => ` -

${data.title}

-
${data.owner.name}
-
${data.owner.organization}
-
${data.owner.bio}
-
${data.owner.dob}
-`).join('

'); - - -/***/ }), +/* 0 */, /* 1 */ /*!*******************!*\ !*** ./data.toml ***! @@ -145,7 +119,7 @@ document.querySelector('#app').innerHTML = [_data_toml__WEBPACK_IMPORTED_MODULE_ /*! runtime requirements: module */ /***/ ((module) => { -module.exports = JSON.parse("{\"title\":\"TOML Example\",\"owner\":{\"name\":\"Tom Preston-Werner\",\"organization\":\"GitHub\",\"bio\":\"GitHub Cofounder & CEO\\nLikes tater tots and beer.\",\"dob\":\"1979-05-27T07:32:00.000Z\"}}"); +module.exports = JSON.parse('{"title":"TOML Example","owner":{"name":"Tom Preston-Werner","organization":"GitHub","bio":"GitHub Cofounder & CEO\\nLikes tater tots and beer.","dob":"1979-05-27T07:32:00.000Z"}}'); /***/ }), /* 2 */ @@ -165,7 +139,7 @@ module.exports = JSON.parse("{\"title\":\"TOML Example\",\"owner\":{\"name\":\"T /*! runtime requirements: module */ /***/ ((module) => { -module.exports = JSON.parse("{\"title\":\"YAML Example\",\"owner\":{\"name\":\"Tom Preston-Werner\",\"organization\":\"GitHub\",\"bio\":\"GitHub Cofounder & CEO\\nLikes tater tots and beer.\",\"dob\":\"1979-05-27T07:32:00.000Z\"}}"); +module.exports = JSON.parse('{"title":"YAML Example","owner":{"name":"Tom Preston-Werner","organization":"GitHub","bio":"GitHub Cofounder & CEO\\nLikes tater tots and beer.","dob":"1979-05-27T07:32:00.000Z"}}'); /***/ }), /* 3 */ @@ -184,7 +158,7 @@ module.exports = JSON.parse("{\"title\":\"YAML Example\",\"owner\":{\"name\":\"T /*! runtime requirements: module */ /***/ ((module) => { -module.exports = JSON.parse("{\"title\":\"JSON5 Example\",\"owner\":{\"name\":\"Tom Preston-Werner\",\"organization\":\"GitHub\",\"bio\":\"GitHub Cofounder & CEO\\nLikes tater tots and beer.\",\"dob\":\"1979-05-27T07:32:00.000Z\"}}"); +module.exports = JSON.parse('{"title":"JSON5 Example","owner":{"name":"Tom Preston-Werner","organization":"GitHub","bio":"GitHub Cofounder & CEO\\nLikes tater tots and beer.","dob":"1979-05-27T07:32:00.000Z"}}'); /***/ }) /******/ ]); @@ -200,8 +174,9 @@ module.exports = JSON.parse("{\"title\":\"JSON5 Example\",\"owner\":{\"name\":\" /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -235,10 +210,33 @@ module.exports = JSON.parse("{\"title\":\"JSON5 Example\",\"owner\":{\"name\":\" ``` js -/******/ // startup -/******/ // Load entry module -/******/ __webpack_require__(0); -/******/ // This entry module used 'exports' so it can't be inlined +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +(() => { +/*!********************!*\ + !*** ./example.js ***! + \********************/ +/*! namespace exports */ +/*! exports [not provided] [no usage info] */ +/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */ +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _data_toml__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./data.toml */ 1); +/* harmony import */ var _data_yaml__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./data.yaml */ 2); +/* harmony import */ var _data_json5__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./data.json5 */ 3); + + + + +document.querySelector('#app').innerHTML = [_data_toml__WEBPACK_IMPORTED_MODULE_0__, _data_yaml__WEBPACK_IMPORTED_MODULE_1__, _data_json5__WEBPACK_IMPORTED_MODULE_2__].map(data => ` +

${data.title}

+
${data.owner.name}
+
${data.owner.organization}
+
${data.owner.bio}
+
${data.owner.dob}
+`).join('

'); + +})(); + /******/ })() ; ``` @@ -248,7 +246,7 @@ module.exports = JSON.parse("{\"title\":\"JSON5 Example\",\"owner\":{\"name\":\" ## webpack output ``` -asset output.js 5.98 KiB [emitted] (name: main) +asset output.js 5.87 KiB [emitted] (name: main) chunk (runtime: main) output.js (main) 919 bytes (javascript) 274 bytes (runtime) [entry] [rendered] > ./example.js main dependent modules 565 bytes [dependent] 3 modules @@ -257,5 +255,5 @@ chunk (runtime: main) output.js (main) 919 bytes (javascript) 274 bytes (runtime [no exports] [used exports unknown] entry ./example.js main -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` diff --git a/examples/dll-app-and-vendor/0-vendor/README.md b/examples/dll-app-and-vendor/0-vendor/README.md index 1e2b1100f7e..03f49db1171 100644 --- a/examples/dll-app-and-vendor/0-vendor/README.md +++ b/examples/dll-app-and-vendor/0-vendor/README.md @@ -41,7 +41,7 @@ export function square(n) { # dist/vendor.js ```javascript -var vendor_lib_d696c7b4f72a4a70f39b;vendor_lib_d696c7b4f72a4a70f39b = +var vendor_lib_51062e5e93ee3a0507e7; /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ([ /* 0 */ @@ -68,7 +68,7 @@ module.exports = __webpack_require__; "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "square": () => /* binding */ square +/* harmony export */ "square": () => (/* binding */ square) /* harmony export */ }); function square(n) { return n * n; @@ -89,8 +89,9 @@ function square(n) { /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -121,7 +122,7 @@ function square(n) { /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop) +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ @@ -141,10 +142,13 @@ function square(n) { ``` js -/******/ // module exports must be returned from runtime so entry inlining is disabled +/******/ /******/ // startup /******/ // Load entry module and return exports -/******/ return __webpack_require__(0); +/******/ // This entry module doesn't tell about it's top-level declarations so it can't be inlined +/******/ var __webpack_exports__ = __webpack_require__(0); +/******/ vendor_lib_51062e5e93ee3a0507e7 = __webpack_exports__; +/******/ /******/ })() ; ``` @@ -152,7 +156,7 @@ function square(n) { # dist/vendor-manifest.json ```javascript -{"name":"vendor_lib_d696c7b4f72a4a70f39b","content":{"../node_modules/example-vendor.js":{"id":1,"buildMeta":{"exportsType":"namespace"},"exports":["square"]}}} +{"name":"vendor_lib_51062e5e93ee3a0507e7","content":{"../node_modules/example-vendor.js":{"id":1,"buildMeta":{"exportsType":"namespace"},"exports":["square"]}}} ``` # Info @@ -160,28 +164,28 @@ function square(n) { ## Unoptimized ``` -asset vendor.js 3.56 KiB [emitted] (name: main) -chunk (runtime: main) vendor.js (main) 57 bytes (javascript) 668 bytes (runtime) [entry] [rendered] +asset vendor.js 3.68 KiB [emitted] (name: main) +chunk (runtime: main) vendor.js (main) 57 bytes (javascript) 670 bytes (runtime) [entry] [rendered] > main - runtime modules 668 bytes 3 modules + runtime modules 670 bytes 3 modules dependent modules 45 bytes [dependent] 1 module dll main 12 bytes [built] [code generated] [used exports unknown] dll entry used as library export -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` ## Production mode ``` -asset vendor.js 638 bytes [emitted] [minimized] (name: main) -chunk (runtime: main) vendor.js (main) 57 bytes (javascript) 668 bytes (runtime) [entry] [rendered] +asset vendor.js 653 bytes [emitted] [minimized] (name: main) +chunk (runtime: main) vendor.js (main) 57 bytes (javascript) 670 bytes (runtime) [entry] [rendered] > main - runtime modules 668 bytes 3 modules + runtime modules 670 bytes 3 modules dependent modules 45 bytes [dependent] 1 module dll main 12 bytes [built] [code generated] dll entry used as library export -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` diff --git a/examples/dll-app-and-vendor/1-app/README.md b/examples/dll-app-and-vendor/1-app/README.md index 83238a34185..4d0ac5032f0 100644 --- a/examples/dll-app-and-vendor/1-app/README.md +++ b/examples/dll-app-and-vendor/1-app/README.md @@ -50,28 +50,10 @@ console.log(new square(7)); ```javascript /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ([ -/* 0 */ -/*!************************!*\ - !*** ./example-app.js ***! - \************************/ -/*! namespace exports */ -/*! exports [not provided] [no usage info] */ -/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var example_vendor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! example-vendor */ 1); - - -console.log((0,example_vendor__WEBPACK_IMPORTED_MODULE_0__.square)(7)); -console.log(new example_vendor__WEBPACK_IMPORTED_MODULE_0__.square(7)); - - -/***/ }), +/* 0 */, /* 1 */ /*!******************************************************************************************************!*\ - !*** delegated ../node_modules/example-vendor.js from dll-reference vendor_lib_d696c7b4f72a4a70f39b ***! + !*** delegated ../node_modules/example-vendor.js from dll-reference vendor_lib_51062e5e93ee3a0507e7 ***! \******************************************************************************************************/ /*! namespace exports */ /*! export square [provided] [no usage info] [provision prevents renaming (no use info)] */ @@ -79,12 +61,12 @@ console.log(new example_vendor__WEBPACK_IMPORTED_MODULE_0__.square(7)); /*! runtime requirements: module, __webpack_require__ */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = (__webpack_require__(/*! dll-reference vendor_lib_d696c7b4f72a4a70f39b */ 2))(1); +module.exports = (__webpack_require__(/*! dll-reference vendor_lib_51062e5e93ee3a0507e7 */ 2))(1); /***/ }), /* 2 */ /*!**************************************************!*\ - !*** external "vendor_lib_d696c7b4f72a4a70f39b" ***! + !*** external "vendor_lib_51062e5e93ee3a0507e7" ***! \**************************************************/ /*! dynamic exports */ /*! exports [maybe provided (runtime-defined)] [no usage info] */ @@ -92,7 +74,7 @@ module.exports = (__webpack_require__(/*! dll-reference vendor_lib_d696c7b4f72a4 /***/ ((module) => { "use strict"; -module.exports = vendor_lib_d696c7b4f72a4a70f39b; +module.exports = vendor_lib_51062e5e93ee3a0507e7; /***/ }) /******/ ]); @@ -108,8 +90,9 @@ module.exports = vendor_lib_d696c7b4f72a4a70f39b; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache -/******/ if(__webpack_module_cache__[moduleId]) { -/******/ return __webpack_module_cache__[moduleId].exports; +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { @@ -143,10 +126,25 @@ module.exports = vendor_lib_d696c7b4f72a4a70f39b; ``` js -/******/ // startup -/******/ // Load entry module -/******/ __webpack_require__(0); -/******/ // This entry module used 'exports' so it can't be inlined +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be in strict mode. +(() => { +"use strict"; +/*!************************!*\ + !*** ./example-app.js ***! + \************************/ +/*! namespace exports */ +/*! exports [not provided] [no usage info] */ +/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */ +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var example_vendor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! example-vendor */ 1); + + +console.log((0,example_vendor__WEBPACK_IMPORTED_MODULE_0__.square)(7)); +console.log(new example_vendor__WEBPACK_IMPORTED_MODULE_0__.square(7)); + +})(); + /******/ })() ; ``` @@ -156,7 +154,7 @@ module.exports = vendor_lib_d696c7b4f72a4a70f39b; ## Unoptimized ``` -asset app.js 3.52 KiB [emitted] (name: main) +asset app.js 3.44 KiB [emitted] (name: main) chunk (runtime: main) app.js (main) 178 bytes (javascript) 274 bytes (runtime) [entry] [rendered] > ./example-app main dependent modules 84 bytes [dependent] 2 modules @@ -165,13 +163,13 @@ chunk (runtime: main) app.js (main) 178 bytes (javascript) 274 bytes (runtime) [ [no exports] [used exports unknown] entry ./example-app main -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ``` ## Production mode ``` -asset app.js 319 bytes [emitted] [minimized] (name: main) +asset app.js 333 bytes [emitted] [minimized] (name: main) chunk (runtime: main) app.js (main) 178 bytes [entry] [rendered] > ./example-app main dependent modules 84 bytes [dependent] 2 modules @@ -179,7 +177,7 @@ chunk (runtime: main) app.js (main) 178 bytes [entry] [rendered] [no exports] [no exports used] entry ./example-app main -webpack 5.11.1 compiled successfully +webpack 5.51.1 compiled successfully ```