From d13137cbac91a970e7305f7c769b3881f82a9a60 Mon Sep 17 00:00:00 2001 From: Gengkun Date: Mon, 29 Apr 2024 20:25:40 +0800 Subject: [PATCH] feat: add message comment for block promise (#6403) --- crates/rspack_core/src/context_module.rs | 1 + .../src/dependency/dependency_type.rs | 2 +- .../src/dependency/runtime_template.rs | 54 +++++++++++++++---- .../src/container/container_entry_module.rs | 2 +- .../__snapshots__/StatsTestCases.test.js.snap | 26 ++++----- .../magic_comment/snapshot/output.snap.txt | 16 +++--- .../imports-multiple/snapshot/output.snap.txt | 2 +- .../code-splitting/snapshot/output.snap.txt | 4 +- .../dynamic-import/snapshot/output.snap.txt | 4 +- .../snapshot/output.snap.txt | 8 +-- .../snapshot/output.snap.txt | 12 ++--- .../cycle-entry/snapshot/output.snap.txt | 6 +-- .../intersection/snapshot/output.snap.txt | 4 +- .../snapshot/output.snap.txt | 8 +-- .../self-import/snapshot/output.snap.txt | 2 +- .../samples/simple/snapshot/output.snap.txt | 2 +- .../snapshot/web/1.snap.txt | 4 +- .../snapshot/web/1.snap.txt | 4 +- .../snapshot/web/3.snap.txt | 4 +- .../snapshot/web/1.snap.txt | 4 +- .../snapshot/new_treeshaking.snap.txt | 2 +- .../snapshot/output.snap.txt | 2 +- .../snapshot/new_treeshaking.snap.txt | 2 +- .../snapshot/output.snap.txt | 2 +- .../snapshot/new_treeshaking.snap.txt | 4 +- .../snapshot/output.snap.txt | 4 +- .../snapshot/new_treeshaking.snap.txt | 2 +- .../snapshot/output.snap.txt | 2 +- ...$.css => async.$a86b1707b4af75e0f088$.css} | 0 ...6$.css => main.$a86b1707b4af75e0f088$.css} | 0 .../chunkFilename-fullhash/expected/main.js | 4 +- .../cases/insert-function/expected/main.js | 2 +- .../cases/insert-string/expected/main.js | 2 +- .../cases/insert-undefined/expected/main.js | 2 +- .../cases/no-runtime/expected/main.js | 2 +- 35 files changed, 118 insertions(+), 83 deletions(-) rename plugin-test/css-extract/cases/chunkFilename-fullhash/expected/{async.$e922852729b051304a06$.css => async.$a86b1707b4af75e0f088$.css} (100%) rename plugin-test/css-extract/cases/chunkFilename-fullhash/expected/{main.$e922852729b051304a06$.css => main.$a86b1707b4af75e0f088$.css} (100%) diff --git a/crates/rspack_core/src/context_module.rs b/crates/rspack_core/src/context_module.rs index d8d0f56f633..9fa4e2f32e2 100644 --- a/crates/rspack_core/src/context_module.rs +++ b/crates/rspack_core/src/context_module.rs @@ -576,6 +576,7 @@ impl ContextModule { Some(block_id), &mut code_gen_result.runtime_requirements, compilation, + "lazy-once context", ); let map = self.get_user_request_map(dependencies, compilation); let fake_map = self.get_fake_map(dependencies, compilation); diff --git a/crates/rspack_core/src/dependency/dependency_type.rs b/crates/rspack_core/src/dependency/dependency_type.rs index 4008173f22f..757dd6920fd 100644 --- a/crates/rspack_core/src/dependency/dependency_type.rs +++ b/crates/rspack_core/src/dependency/dependency_type.rs @@ -108,7 +108,7 @@ impl DependencyType { DependencyType::EsmImportSpecifier => Cow::Borrowed("esm import specifier"), DependencyType::EsmExportExpression => Cow::Borrowed("esm export expression"), DependencyType::EsmExportHeader => Cow::Borrowed("esm export header"), - DependencyType::DynamicImport => Cow::Borrowed("dynamic import"), + DependencyType::DynamicImport => Cow::Borrowed("import()"), DependencyType::CjsRequire => Cow::Borrowed("cjs require"), DependencyType::CjsFullRequire => Cow::Borrowed("cjs full require"), DependencyType::CjsExports => Cow::Borrowed("cjs exports"), diff --git a/crates/rspack_core/src/dependency/runtime_template.rs b/crates/rspack_core/src/dependency/runtime_template.rs index 75c1c1c391c..5c4ceab212c 100644 --- a/crates/rspack_core/src/dependency/runtime_template.rs +++ b/crates/rspack_core/src/dependency/runtime_template.rs @@ -379,7 +379,7 @@ pub fn module_namespace_promise( dep_id: &DependencyId, block: Option<&AsyncDependenciesBlockIdentifier>, request: &str, - _message: &str, + message: &str, weak: bool, ) -> String { let TemplateContext { @@ -396,7 +396,7 @@ pub fn module_namespace_promise( return missing_module_promise(request); }; - let promise = block_promise(block, runtime_requirements, compilation); + let promise = block_promise(block, runtime_requirements, compilation, message); let exports_type = get_exports_type( &compilation.get_module_graph(), dep_id, @@ -499,20 +499,54 @@ pub fn block_promise( block: Option<&AsyncDependenciesBlockIdentifier>, runtime_requirements: &mut RuntimeGlobals, compilation: &Compilation, + message: &str, ) -> String { let Some(block) = block else { - // ImportEagerDependency - return "Promise.resolve()".to_string(); + let comment = comment( + &compilation.options, + CommentOptions { + request: None, + chunk_name: None, + message: Some(message), + }, + ); + return format!("Promise.resolve({comment})"); }; let chunk_group = compilation .chunk_graph .get_block_chunk_group(block, &compilation.chunk_group_by_ukey); let Some(chunk_group) = chunk_group else { - return "Promise.resolve()".to_string(); + let comment = comment( + &compilation.options, + CommentOptions { + request: None, + chunk_name: None, + message: Some(message), + }, + ); + return format!("Promise.resolve({comment})"); }; if chunk_group.chunks.is_empty() { - return "Promise.resolve()".to_string(); + let comment = comment( + &compilation.options, + CommentOptions { + request: None, + chunk_name: None, + message: Some(message), + }, + ); + return format!("Promise.resolve({comment})"); } + let mg = compilation.get_module_graph(); + let block = mg.block_by_id_expect(block); + let comment = comment( + &compilation.options, + CommentOptions { + request: None, + chunk_name: block.get_group_options().and_then(|o| o.name()), + message: Some(message), + }, + ); let chunks = chunk_group .chunks .iter() @@ -523,11 +557,11 @@ pub fn block_promise( let chunk_id = serde_json::to_string(chunks[0].id.as_ref().expect("should have chunk.id")) .expect("should able to json stringify"); runtime_requirements.insert(RuntimeGlobals::ENSURE_CHUNK); - format!("{}({chunk_id})", RuntimeGlobals::ENSURE_CHUNK) + format!("{}({comment}{chunk_id})", RuntimeGlobals::ENSURE_CHUNK) } else if !chunks.is_empty() { runtime_requirements.insert(RuntimeGlobals::ENSURE_CHUNK); format!( - "Promise.all([{}])", + "Promise.all({comment}[{}])", chunks .iter() .map(|c| format!( @@ -540,7 +574,7 @@ pub fn block_promise( .join(", ") ) } else { - "Promise.resolve()".to_string() + format!("Promise.resolve({comment})") } } @@ -635,7 +669,7 @@ pub fn async_module_factory( .block_by_id(block_id) .expect("should have block"); let dep = block.get_dependencies()[0]; - let ensure_chunk = block_promise(Some(block_id), runtime_requirements, compilation); + let ensure_chunk = block_promise(Some(block_id), runtime_requirements, compilation, ""); let factory = returning_function( &module_raw(compilation, runtime_requirements, &dep, request, false), "", diff --git a/crates/rspack_plugin_mf/src/container/container_entry_module.rs b/crates/rspack_plugin_mf/src/container/container_entry_module.rs index 48a275c9932..62895feb922 100644 --- a/crates/rspack_plugin_mf/src/container/container_entry_module.rs +++ b/crates/rspack_plugin_mf/src/container/container_entry_module.rs @@ -314,7 +314,7 @@ impl ExposeModuleMap { .join(", "), ) } else { - let block_promise = block_promise(Some(block_id), runtime_requirements, compilation); + let block_promise = block_promise(Some(block_id), runtime_requirements, compilation, ""); let module_raw = returning_function( &returning_function( &modules_iter diff --git a/packages/rspack-test-tools/tests/__snapshots__/StatsTestCases.test.js.snap b/packages/rspack-test-tools/tests/__snapshots__/StatsTestCases.test.js.snap index 3132de444c5..451e3f048aa 100644 --- a/packages/rspack-test-tools/tests/__snapshots__/StatsTestCases.test.js.snap +++ b/packages/rspack-test-tools/tests/__snapshots__/StatsTestCases.test.js.snap @@ -66,12 +66,12 @@ Rspack x.x.x compiled with 1 error in X s (6a173f34164e1af948e4)" exports[`StatsTestCases should print correct stats for filename 1`] = ` "PublicPath: auto asset 521.xxxx.js 335 bytes [emitted] -asset 909.xxxx.js 8.72 KiB [emitted] (name: main) -Entrypoint main 8.72 KiB = 909.xxxx.js +asset 909.xxxx.js 8.73 KiB [emitted] (name: main) +Entrypoint main 8.73 KiB = 909.xxxx.js runtime modules 11 modules ./index.js ./dynamic.js -Rspack x.x.x compiled successfully in X s (a605a17d8616567b9f8b)" +Rspack x.x.x compiled successfully in X s (185b80456c181897fcd5)" `; exports[`StatsTestCases should print correct stats for hot+production 1`] = ` @@ -125,19 +125,19 @@ Rspack compiled with 2 errors" exports[`StatsTestCases should print correct stats for limit-chunk-count-plugin 1`] = ` "1 chunks: PublicPath: auto - asset bundle1.js 3.45 KiB [emitted] (name: main) - Entrypoint main 3.45 KiB = bundle1.js + asset bundle1.js 3.5 KiB [emitted] (name: main) + Entrypoint main 3.5 KiB = bundle1.js chunk bundle1.js (main) <{909}> >{909}< [entry] ./b.js ./c.js ./d.js ./e.js ./index.js - 1 chunks (Rspack x.x.x) compiled successfully in X s (0c10f85791d2b49cd72e) + 1 chunks (Rspack x.x.x) compiled successfully in X s (0d76b7dadd0c657ad341) 2 chunks: PublicPath: auto - asset 76.bundle2.js 465 bytes [emitted] (name: c) + asset 76.bundle2.js 495 bytes [emitted] (name: c) asset bundle2.js 10.1 KiB [emitted] (name: main) Entrypoint main 10.1 KiB = bundle2.js chunk 76.bundle2.js (c) <{76}> <{909}> >{76}< @@ -147,12 +147,12 @@ exports[`StatsTestCases should print correct stats for limit-chunk-count-plugin chunk bundle2.js (main) >{76}< [entry] ./b.js ./index.js - 2 chunks (Rspack x.x.x) compiled successfully in X s (9fdb65a92ff09f5c7e0a) + 2 chunks (Rspack x.x.x) compiled successfully in X s (a80080d4a166d3a145b2) 3 chunks: PublicPath: auto asset 345.bundle3.js 182 bytes [emitted] - asset 76.bundle3.js 359 bytes [emitted] (name: c) + asset 76.bundle3.js 389 bytes [emitted] (name: c) asset bundle3.js 10.1 KiB [emitted] (name: main) Entrypoint main 10.1 KiB = bundle3.js chunk 345.bundle3.js <{76}> @@ -163,13 +163,13 @@ exports[`StatsTestCases should print correct stats for limit-chunk-count-plugin chunk bundle3.js (main) >{76}< [entry] ./b.js ./index.js - 3 chunks (Rspack x.x.x) compiled successfully in X s (2528b9b2df61ea01f70c) + 3 chunks (Rspack x.x.x) compiled successfully in X s (0e854af4043d4cced12b) 4 chunks: PublicPath: auto asset 697.bundle4.js 128 bytes [emitted] asset 753.bundle4.js 128 bytes [emitted] - asset 76.bundle4.js 359 bytes [emitted] (name: c) + asset 76.bundle4.js 389 bytes [emitted] (name: c) asset bundle4.js 10.1 KiB [emitted] (name: main) Entrypoint main 10.1 KiB = bundle4.js chunk 697.bundle4.js <{76}> @@ -181,7 +181,7 @@ exports[`StatsTestCases should print correct stats for limit-chunk-count-plugin chunk bundle4.js (main) >{76}< [entry] ./b.js ./index.js - 4 chunks (Rspack x.x.x) compiled successfully in X s (2551584c072908e69932)" + 4 chunks (Rspack x.x.x) compiled successfully in X s (4525b2f4f1626b91a6f4)" `; exports[`StatsTestCases should print correct stats for logging-loader 1`] = ` @@ -206,7 +206,7 @@ Rspack compiled with 1 error" `; exports[`StatsTestCases should print correct stats for named-chunk-group 1`] = ` -"Entrypoint main 8.7 KiB = main.js +"Entrypoint main 8.72 KiB = main.js Chunk Group cimanyd 335 bytes = cimanyd.js" `; diff --git a/packages/rspack-test-tools/tests/builtinCases/plugin-javascript/magic_comment/snapshot/output.snap.txt b/packages/rspack-test-tools/tests/builtinCases/plugin-javascript/magic_comment/snapshot/output.snap.txt index af9e5382f6f..b5c094f3e01 100644 --- a/packages/rspack-test-tools/tests/builtinCases/plugin-javascript/magic_comment/snapshot/output.snap.txt +++ b/packages/rspack-test-tools/tests/builtinCases/plugin-javascript/magic_comment/snapshot/output.snap.txt @@ -46,14 +46,14 @@ console.log("123"); ```js title=main.js (self['webpackChunkwebpack'] = self['webpackChunkwebpack'] || []).push([["main"], { "./index.js": (function (__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { -__webpack_require__.e("normal").then(__webpack_require__.t.bind(__webpack_require__, "./normal.js", 23)); -__webpack_require__.e("./sub/fold").then(__webpack_require__.t.bind(__webpack_require__, "./sub_fold.js", 23)); -__webpack_require__.e("./sub/single").then(__webpack_require__.t.bind(__webpack_require__, "./single_quote.js", 23)); -__webpack_require__.e("./sub/other").then(__webpack_require__.t.bind(__webpack_require__, "./other.js", 23)); -__webpack_require__.e("./user/[id]").then(__webpack_require__.t.bind(__webpack_require__, "./user/1.js", 23)); -__webpack_require__.e("user/[id]/page").then(__webpack_require__.t.bind(__webpack_require__, "./user/page/2.js", 23)); -__webpack_require__.e("user/(id)/page").then(__webpack_require__.t.bind(__webpack_require__, "./user/page/3.js", 23)); -__webpack_require__.e("bug_only_single_quote_js").then(__webpack_require__.t.bind(__webpack_require__, "./bug_only_single_quote.js", 23)); +__webpack_require__.e(/* import() | normal */ "normal").then(__webpack_require__.t.bind(__webpack_require__, "./normal.js", 23)); +__webpack_require__.e(/* import() | ./sub/fold */ "./sub/fold").then(__webpack_require__.t.bind(__webpack_require__, "./sub_fold.js", 23)); +__webpack_require__.e(/* import() | ./sub/single */ "./sub/single").then(__webpack_require__.t.bind(__webpack_require__, "./single_quote.js", 23)); +__webpack_require__.e(/* import() | ./sub/other */ "./sub/other").then(__webpack_require__.t.bind(__webpack_require__, "./other.js", 23)); +__webpack_require__.e(/* import() | ./user/[id] */ "./user/[id]").then(__webpack_require__.t.bind(__webpack_require__, "./user/1.js", 23)); +__webpack_require__.e(/* import() | user/[id]/page */ "user/[id]/page").then(__webpack_require__.t.bind(__webpack_require__, "./user/page/2.js", 23)); +__webpack_require__.e(/* import() | user/(id)/page */ "user/(id)/page").then(__webpack_require__.t.bind(__webpack_require__, "./user/page/3.js", 23)); +__webpack_require__.e(/* import() */ "bug_only_single_quote_js").then(__webpack_require__.t.bind(__webpack_require__, "./bug_only_single_quote.js", 23)); }), },function(__webpack_require__) { diff --git a/packages/rspack-test-tools/tests/builtinCases/plugin-wasm/imports-multiple/snapshot/output.snap.txt b/packages/rspack-test-tools/tests/builtinCases/plugin-wasm/imports-multiple/snapshot/output.snap.txt index db7532521d4..80391e585b9 100644 --- a/packages/rspack-test-tools/tests/builtinCases/plugin-wasm/imports-multiple/snapshot/output.snap.txt +++ b/packages/rspack-test-tools/tests/builtinCases/plugin-wasm/imports-multiple/snapshot/output.snap.txt @@ -2,7 +2,7 @@ (self['webpackChunkwebpack'] = self['webpackChunkwebpack'] || []).push([["main"], { "./index.js": (function (__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { (async function() { - return __webpack_require__.e("wasm_wasm").then(__webpack_require__.bind(__webpack_require__, "./module.js")).then(function(mod) { + return __webpack_require__.e(/* import() */ "wasm_wasm").then(__webpack_require__.bind(__webpack_require__, "./module.js")).then(function(mod) { if (mod.result !== 42) throw new Error("panic"); }); })(); diff --git a/packages/rspack-test-tools/tests/builtinCases/rspack/code-splitting/snapshot/output.snap.txt b/packages/rspack-test-tools/tests/builtinCases/rspack/code-splitting/snapshot/output.snap.txt index b5a2680d5d2..2e317511521 100644 --- a/packages/rspack-test-tools/tests/builtinCases/rspack/code-splitting/snapshot/output.snap.txt +++ b/packages/rspack-test-tools/tests/builtinCases/rspack/code-splitting/snapshot/output.snap.txt @@ -20,8 +20,8 @@ console.log("b"); (self['webpackChunkwebpack'] = self['webpackChunkwebpack'] || []).push([["main"], { "./index.js": (function (__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { console.log("hello, world"); -__webpack_require__.e("a_js").then(__webpack_require__.t.bind(__webpack_require__, "./a.js", 23)); -__webpack_require__.e("b_js").then(__webpack_require__.t.bind(__webpack_require__, "./b.js", 23)); +__webpack_require__.e(/* import() */ "a_js").then(__webpack_require__.t.bind(__webpack_require__, "./a.js", 23)); +__webpack_require__.e(/* import() */ "b_js").then(__webpack_require__.t.bind(__webpack_require__, "./b.js", 23)); }), },function(__webpack_require__) { diff --git a/packages/rspack-test-tools/tests/builtinCases/rspack/dynamic-import/snapshot/output.snap.txt b/packages/rspack-test-tools/tests/builtinCases/rspack/dynamic-import/snapshot/output.snap.txt index 2c9e9b3ee14..0347bac9f8f 100644 --- a/packages/rspack-test-tools/tests/builtinCases/rspack/dynamic-import/snapshot/output.snap.txt +++ b/packages/rspack-test-tools/tests/builtinCases/rspack/dynamic-import/snapshot/output.snap.txt @@ -60,8 +60,8 @@ module.exports = webpackAsyncContext; }), "./index.js": (function (__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { const request = "a"; -__webpack_require__.e("child_a_js").then(__webpack_require__.bind(__webpack_require__, "./child/a.js")).then(({ a })=>console.log("Literal", a)); -__webpack_require__.e("child_b_js").then(__webpack_require__.bind(__webpack_require__, "./child/b.js")).then(({ b })=>console.log("Template Literal", b)); +__webpack_require__.e(/* import() */ "child_a_js").then(__webpack_require__.bind(__webpack_require__, "./child/a.js")).then(({ a })=>console.log("Literal", a)); +__webpack_require__.e(/* import() */ "child_b_js").then(__webpack_require__.bind(__webpack_require__, "./child/b.js")).then(({ b })=>console.log("Template Literal", b)); __webpack_require__("./child lazy recursive ^\\.\\/.*\\.js$")(`./${request}.js`).then(({ a })=>console.log("context_module_tpl", a)); __webpack_require__("./child lazy recursive ^\\.\\/.*\\.js$")("./" + request + ".js").then(({ a })=>console.log("context_module_bin", a)); __webpack_require__("./child lazy recursive ^\\.\\/.*\\.js$")("./".concat(request, ".js")).then(({ a })=>console.log("context_module_concat", a)); diff --git a/packages/rspack-test-tools/tests/builtinCases/samples/ancestor-has-all-modules/snapshot/output.snap.txt b/packages/rspack-test-tools/tests/builtinCases/samples/ancestor-has-all-modules/snapshot/output.snap.txt index 1d3d7f936c5..bacc541abdd 100644 --- a/packages/rspack-test-tools/tests/builtinCases/samples/ancestor-has-all-modules/snapshot/output.snap.txt +++ b/packages/rspack-test-tools/tests/builtinCases/samples/ancestor-has-all-modules/snapshot/output.snap.txt @@ -8,8 +8,8 @@ module.exports = "foo"; /* harmony import */var _foo_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./foo.js"); /* harmony import */var _foo_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_foo_js__WEBPACK_IMPORTED_MODULE_0__); -__webpack_require__.e("parent-1_js").then(__webpack_require__.t.bind(__webpack_require__, "./parent-1.js", 23)); -__webpack_require__.e("parent-2_js").then(__webpack_require__.t.bind(__webpack_require__, "./parent-2.js", 23)); +__webpack_require__.e(/* import() */ "parent-1_js").then(__webpack_require__.t.bind(__webpack_require__, "./parent-1.js", 23)); +__webpack_require__.e(/* import() */ "parent-2_js").then(__webpack_require__.t.bind(__webpack_require__, "./parent-2.js", 23)); }), },function(__webpack_require__) { @@ -23,7 +23,7 @@ var __webpack_exports__ = (__webpack_exec__("./index.js")); ```js title=parent-1_js.js (self['webpackChunkwebpack'] = self['webpackChunkwebpack'] || []).push([["parent-1_js"], { "./parent-1.js": (function (__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { -__webpack_require__.e("shared_js").then(__webpack_require__.bind(__webpack_require__, "./shared.js")); +__webpack_require__.e(/* import() */ "shared_js").then(__webpack_require__.bind(__webpack_require__, "./shared.js")); }), }]); @@ -32,7 +32,7 @@ __webpack_require__.e("shared_js").then(__webpack_require__.bind(__webpack_requi ```js title=parent-2_js.js (self['webpackChunkwebpack'] = self['webpackChunkwebpack'] || []).push([["parent-2_js"], { "./parent-2.js": (function (__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { -__webpack_require__.e("shared_js").then(__webpack_require__.bind(__webpack_require__, "./shared.js")); +__webpack_require__.e(/* import() */ "shared_js").then(__webpack_require__.bind(__webpack_require__, "./shared.js")); }), }]); diff --git a/packages/rspack-test-tools/tests/builtinCases/samples/cycle-dynamic-entry/snapshot/output.snap.txt b/packages/rspack-test-tools/tests/builtinCases/samples/cycle-dynamic-entry/snapshot/output.snap.txt index e1c86a2973a..cb347ea61ae 100644 --- a/packages/rspack-test-tools/tests/builtinCases/samples/cycle-dynamic-entry/snapshot/output.snap.txt +++ b/packages/rspack-test-tools/tests/builtinCases/samples/cycle-dynamic-entry/snapshot/output.snap.txt @@ -6,7 +6,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */var _shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./shared.js"); /* harmony import */var _shared__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_shared__WEBPACK_IMPORTED_MODULE_0__); -__webpack_require__.e("dynamic-2_js-_15a90").then(__webpack_require__.bind(__webpack_require__, "./dynamic-2.js")); +__webpack_require__.e(/* import() */ "dynamic-2_js-_15a90").then(__webpack_require__.bind(__webpack_require__, "./dynamic-2.js")); console.log("dynamic-1"); }), @@ -21,7 +21,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */var _shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./shared.js"); /* harmony import */var _shared__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_shared__WEBPACK_IMPORTED_MODULE_0__); -__webpack_require__.e("dynamic-2_js-_15a90").then(__webpack_require__.bind(__webpack_require__, "./dynamic-2.js")); +__webpack_require__.e(/* import() */ "dynamic-2_js-_15a90").then(__webpack_require__.bind(__webpack_require__, "./dynamic-2.js")); console.log("dynamic-1"); }), "./shared.js": (function () { @@ -39,7 +39,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */var _shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./shared.js"); /* harmony import */var _shared__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_shared__WEBPACK_IMPORTED_MODULE_0__); -__webpack_require__.e("dynamic-1_js-_1d740").then(__webpack_require__.bind(__webpack_require__, "./dynamic-1.js")); +__webpack_require__.e(/* import() */ "dynamic-1_js-_1d740").then(__webpack_require__.bind(__webpack_require__, "./dynamic-1.js")); console.log("dynamic-2"); }), @@ -54,7 +54,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */var _shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./shared.js"); /* harmony import */var _shared__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_shared__WEBPACK_IMPORTED_MODULE_0__); -__webpack_require__.e("dynamic-1_js-_1d740").then(__webpack_require__.bind(__webpack_require__, "./dynamic-1.js")); +__webpack_require__.e(/* import() */ "dynamic-1_js-_1d740").then(__webpack_require__.bind(__webpack_require__, "./dynamic-1.js")); console.log("dynamic-2"); }), "./shared.js": (function () { @@ -67,8 +67,8 @@ console.log("shared"); ```js title=main.js (self['webpackChunkwebpack'] = self['webpackChunkwebpack'] || []).push([["main"], { "./index.js": (function (__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { -__webpack_require__.e("dynamic-1_js-_1d741").then(__webpack_require__.bind(__webpack_require__, "./dynamic-1.js")); -__webpack_require__.e("dynamic-2_js-_15a91").then(__webpack_require__.bind(__webpack_require__, "./dynamic-2.js")); +__webpack_require__.e(/* import() */ "dynamic-1_js-_1d741").then(__webpack_require__.bind(__webpack_require__, "./dynamic-1.js")); +__webpack_require__.e(/* import() */ "dynamic-2_js-_15a91").then(__webpack_require__.bind(__webpack_require__, "./dynamic-2.js")); console.log("index"); }), diff --git a/packages/rspack-test-tools/tests/builtinCases/samples/cycle-entry/snapshot/output.snap.txt b/packages/rspack-test-tools/tests/builtinCases/samples/cycle-entry/snapshot/output.snap.txt index 80910a40318..463c1e15c44 100644 --- a/packages/rspack-test-tools/tests/builtinCases/samples/cycle-entry/snapshot/output.snap.txt +++ b/packages/rspack-test-tools/tests/builtinCases/samples/cycle-entry/snapshot/output.snap.txt @@ -5,7 +5,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */var _shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./shared.js"); /* harmony import */var _shared__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_shared__WEBPACK_IMPORTED_MODULE_0__); -Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "./index.js")); +Promise.resolve(/* import() */ ).then(__webpack_require__.bind(__webpack_require__, "./index.js")); console.log("index1"); }), @@ -27,7 +27,7 @@ var __webpack_exports__ = (__webpack_exec__("./index.js")); "use strict"; /* harmony import */var _shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./shared.js"); /* harmony import */var _shared__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_shared__WEBPACK_IMPORTED_MODULE_0__); -__webpack_require__.e("index_js").then(__webpack_require__.bind(__webpack_require__, "./index.js")); +__webpack_require__.e(/* import() */ "index_js").then(__webpack_require__.bind(__webpack_require__, "./index.js")); console.log("index2"); }), @@ -50,7 +50,7 @@ var __webpack_exports__ = (__webpack_exec__("./index2.js")); __webpack_require__.r(__webpack_exports__); /* harmony import */var _shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./shared.js"); /* harmony import */var _shared__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_shared__WEBPACK_IMPORTED_MODULE_0__); -Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "./index.js")); +Promise.resolve(/* import() */ ).then(__webpack_require__.bind(__webpack_require__, "./index.js")); console.log("index1"); }), diff --git a/packages/rspack-test-tools/tests/builtinCases/samples/intersection/snapshot/output.snap.txt b/packages/rspack-test-tools/tests/builtinCases/samples/intersection/snapshot/output.snap.txt index b01ae3df0ce..db9fd54cbf6 100644 --- a/packages/rspack-test-tools/tests/builtinCases/samples/intersection/snapshot/output.snap.txt +++ b/packages/rspack-test-tools/tests/builtinCases/samples/intersection/snapshot/output.snap.txt @@ -57,7 +57,7 @@ console.log("i-1"); /* harmony import */var _i_1__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_i_1__WEBPACK_IMPORTED_MODULE_1__); -__webpack_require__.e("a_js-_9b1b1").then(__webpack_require__.bind(__webpack_require__, "./a.js")); +__webpack_require__.e(/* import() */ "a_js-_9b1b1").then(__webpack_require__.bind(__webpack_require__, "./a.js")); console.log("index"); }), "./shared.js": (function () { @@ -85,7 +85,7 @@ console.log("i-2"); /* harmony import */var _i_2__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_i_2__WEBPACK_IMPORTED_MODULE_1__); -__webpack_require__.e("a_js-_9b1b0").then(__webpack_require__.bind(__webpack_require__, "./a.js")); +__webpack_require__.e(/* import() */ "a_js-_9b1b0").then(__webpack_require__.bind(__webpack_require__, "./a.js")); console.log("index"); }), "./shared.js": (function () { diff --git a/packages/rspack-test-tools/tests/builtinCases/samples/parent-have-partial-module/snapshot/output.snap.txt b/packages/rspack-test-tools/tests/builtinCases/samples/parent-have-partial-module/snapshot/output.snap.txt index 51813efe660..5b2613f517b 100644 --- a/packages/rspack-test-tools/tests/builtinCases/samples/parent-have-partial-module/snapshot/output.snap.txt +++ b/packages/rspack-test-tools/tests/builtinCases/samples/parent-have-partial-module/snapshot/output.snap.txt @@ -1,8 +1,8 @@ ```js title=index.js (self['webpackChunkwebpack'] = self['webpackChunkwebpack'] || []).push([["index"], { "./index.js": (function (__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { -__webpack_require__.e("parent-1_js").then(__webpack_require__.bind(__webpack_require__, "./parent-1.js")); -__webpack_require__.e("parent-2_js").then(__webpack_require__.t.bind(__webpack_require__, "./parent-2.js", 23)); +__webpack_require__.e(/* import() */ "parent-1_js").then(__webpack_require__.bind(__webpack_require__, "./parent-1.js")); +__webpack_require__.e(/* import() */ "parent-2_js").then(__webpack_require__.t.bind(__webpack_require__, "./parent-2.js", 23)); }), },function(__webpack_require__) { @@ -24,7 +24,7 @@ __webpack_require__.r(__webpack_exports__); /* harmony import */var _exist__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./exist.js"); /* harmony import */var _exist__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_exist__WEBPACK_IMPORTED_MODULE_0__); -__webpack_require__.e("shared_js-_ac581").then(__webpack_require__.bind(__webpack_require__, "./shared.js")); +__webpack_require__.e(/* import() */ "shared_js-_ac581").then(__webpack_require__.bind(__webpack_require__, "./shared.js")); }), }]); @@ -33,7 +33,7 @@ __webpack_require__.e("shared_js-_ac581").then(__webpack_require__.bind(__webpac ```js title=parent-2_js.js (self['webpackChunkwebpack'] = self['webpackChunkwebpack'] || []).push([["parent-2_js"], { "./parent-2.js": (function (__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { -__webpack_require__.e("shared_js-_ac580").then(__webpack_require__.bind(__webpack_require__, "./shared.js")); +__webpack_require__.e(/* import() */ "shared_js-_ac580").then(__webpack_require__.bind(__webpack_require__, "./shared.js")); }), }]); diff --git a/packages/rspack-test-tools/tests/builtinCases/samples/self-import/snapshot/output.snap.txt b/packages/rspack-test-tools/tests/builtinCases/samples/self-import/snapshot/output.snap.txt index b4b9aa2b458..9adcdc0823b 100644 --- a/packages/rspack-test-tools/tests/builtinCases/samples/self-import/snapshot/output.snap.txt +++ b/packages/rspack-test-tools/tests/builtinCases/samples/self-import/snapshot/output.snap.txt @@ -1,7 +1,7 @@ ```js title=main.js (self['webpackChunkwebpack'] = self['webpackChunkwebpack'] || []).push([["main"], { "./index.js": (function (__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { -Promise.resolve().then(__webpack_require__.t.bind(__webpack_require__, "./index.js", 23)); +Promise.resolve(/* import() */ ).then(__webpack_require__.t.bind(__webpack_require__, "./index.js", 23)); console.log("index"); }), diff --git a/packages/rspack-test-tools/tests/builtinCases/samples/simple/snapshot/output.snap.txt b/packages/rspack-test-tools/tests/builtinCases/samples/simple/snapshot/output.snap.txt index 9cc45d24678..272776f2e8c 100644 --- a/packages/rspack-test-tools/tests/builtinCases/samples/simple/snapshot/output.snap.txt +++ b/packages/rspack-test-tools/tests/builtinCases/samples/simple/snapshot/output.snap.txt @@ -19,7 +19,7 @@ console.log("a"); /* harmony import */var _shared__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./shared.js"); /* harmony import */var _shared__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_shared__WEBPACK_IMPORTED_MODULE_0__); -__webpack_require__.e("a_js").then(__webpack_require__.bind(__webpack_require__, "./a.js")); +__webpack_require__.e(/* import() */ "a_js").then(__webpack_require__.bind(__webpack_require__, "./a.js")); console.log("index"); }), "./shared.js": (function () { diff --git a/packages/rspack-test-tools/tests/hotCases/chunk/ensure-chunk-change-to-promise-all/snapshot/web/1.snap.txt b/packages/rspack-test-tools/tests/hotCases/chunk/ensure-chunk-change-to-promise-all/snapshot/web/1.snap.txt index e0e4ab36da7..5bc26c55545 100644 --- a/packages/rspack-test-tools/tests/hotCases/chunk/ensure-chunk-change-to-promise-all/snapshot/web/1.snap.txt +++ b/packages/rspack-test-tools/tests/hotCases/chunk/ensure-chunk-change-to-promise-all/snapshot/web/1.snap.txt @@ -9,7 +9,7 @@ - Bundle: vendors-node_modules_vue_js.chunk.CURRENT_HASH.js - Manifest: main.LAST_HASH.hot-update.json, size: 94 - Update: file_js.LAST_HASH.hot-update.js, size: 450 -- Update: main.LAST_HASH.hot-update.js, size: 693 +- Update: main.LAST_HASH.hot-update.js, size: 709 ## Manifest @@ -67,7 +67,7 @@ __webpack_require__.d(__webpack_exports__, { test: function() { return test; } }); function test(count) { - return Promise.all([__webpack_require__.e("vendors-node_modules_vue_js"), __webpack_require__.e("file_js")]).then(__webpack_require__.bind(__webpack_require__, /*! ./file */ "./file.js")).then(({ React, Vue })=>count === 0 ? React : Vue); + return Promise.all(/*! import() */ [__webpack_require__.e("vendors-node_modules_vue_js"), __webpack_require__.e("file_js")]).then(__webpack_require__.bind(__webpack_require__, /*! ./file */ "./file.js")).then(({ React, Vue })=>count === 0 ? React : Vue); } }), diff --git a/packages/rspack-test-tools/tests/hotCases/runtime/dispose-removed-chunk/snapshot/web/1.snap.txt b/packages/rspack-test-tools/tests/hotCases/runtime/dispose-removed-chunk/snapshot/web/1.snap.txt index 912e4f91c1d..2c58405e2c7 100644 --- a/packages/rspack-test-tools/tests/hotCases/runtime/dispose-removed-chunk/snapshot/web/1.snap.txt +++ b/packages/rspack-test-tools/tests/hotCases/runtime/dispose-removed-chunk/snapshot/web/1.snap.txt @@ -9,7 +9,7 @@ - Bundle: b_js.CURRENT_HASH.js - Bundle: bundle.js - Manifest: main.LAST_HASH.hot-update.json, size: 42 -- Update: main.LAST_HASH.hot-update.js, size: 526 +- Update: main.LAST_HASH.hot-update.js, size: 542 ## Manifest @@ -37,7 +37,7 @@ self["webpackHotUpdate"]('main', { "./module.js": (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); -/* harmony default export */ __webpack_exports__["default"] = (__webpack_require__.e("b_js").then(__webpack_require__.bind(__webpack_require__, /*! ./b */ "./b.js"))); +/* harmony default export */ __webpack_exports__["default"] = (__webpack_require__.e(/*! import() */ "b_js").then(__webpack_require__.bind(__webpack_require__, /*! ./b */ "./b.js"))); }), },function(__webpack_require__) { diff --git a/packages/rspack-test-tools/tests/hotCases/runtime/dispose-removed-chunk/snapshot/web/3.snap.txt b/packages/rspack-test-tools/tests/hotCases/runtime/dispose-removed-chunk/snapshot/web/3.snap.txt index e556dcc6e1f..e687e15dc58 100644 --- a/packages/rspack-test-tools/tests/hotCases/runtime/dispose-removed-chunk/snapshot/web/3.snap.txt +++ b/packages/rspack-test-tools/tests/hotCases/runtime/dispose-removed-chunk/snapshot/web/3.snap.txt @@ -9,7 +9,7 @@ - Bundle: a_js.CURRENT_HASH.js - Bundle: bundle.js - Manifest: main.LAST_HASH.hot-update.json, size: 42 -- Update: main.LAST_HASH.hot-update.js, size: 526 +- Update: main.LAST_HASH.hot-update.js, size: 542 ## Manifest @@ -37,7 +37,7 @@ self["webpackHotUpdate"]('main', { "./module.js": (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); -/* harmony default export */ __webpack_exports__["default"] = (__webpack_require__.e("a_js").then(__webpack_require__.bind(__webpack_require__, /*! ./a */ "./a.js"))); +/* harmony default export */ __webpack_exports__["default"] = (__webpack_require__.e(/*! import() */ "a_js").then(__webpack_require__.bind(__webpack_require__, /*! ./a */ "./a.js"))); }), },function(__webpack_require__) { diff --git a/packages/rspack-test-tools/tests/hotCases/runtime/replace-runtime-module/snapshot/web/1.snap.txt b/packages/rspack-test-tools/tests/hotCases/runtime/replace-runtime-module/snapshot/web/1.snap.txt index 3f213071db0..71c8c8cb388 100644 --- a/packages/rspack-test-tools/tests/hotCases/runtime/replace-runtime-module/snapshot/web/1.snap.txt +++ b/packages/rspack-test-tools/tests/hotCases/runtime/replace-runtime-module/snapshot/web/1.snap.txt @@ -7,7 +7,7 @@ - Bundle: b.chunk.CURRENT_HASH.js - Bundle: bundle.js - Manifest: main.LAST_HASH.hot-update.json, size: 39 -- Update: main.LAST_HASH.hot-update.js, size: 523 +- Update: main.LAST_HASH.hot-update.js, size: 543 ## Manifest @@ -35,7 +35,7 @@ self["webpackHotUpdate"]('main', { "./module.js": (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); -/* harmony default export */ __webpack_exports__["default"] = (__webpack_require__.e("b").then(__webpack_require__.bind(__webpack_require__, /*! ./b */ "./b.js"))); +/* harmony default export */ __webpack_exports__["default"] = (__webpack_require__.e(/*! import() | b */ "b").then(__webpack_require__.bind(__webpack_require__, /*! ./b */ "./b.js"))); }), },function(__webpack_require__) { diff --git a/packages/rspack-test-tools/tests/treeShakingCases/tree-shaking-interop/snapshot/new_treeshaking.snap.txt b/packages/rspack-test-tools/tests/treeShakingCases/tree-shaking-interop/snapshot/new_treeshaking.snap.txt index 73a5fcbc0d4..9106960fa49 100644 --- a/packages/rspack-test-tools/tests/treeShakingCases/tree-shaking-interop/snapshot/new_treeshaking.snap.txt +++ b/packages/rspack-test-tools/tests/treeShakingCases/tree-shaking-interop/snapshot/new_treeshaking.snap.txt @@ -20,7 +20,7 @@ __webpack_require__.r(__webpack_exports__); __webpack_require__.d(__webpack_exports__, { a: function() { return a; } }); -__webpack_require__.e("bar_js").then(__webpack_require__.bind(__webpack_require__, "./bar.js")).then((mod)=>{ +__webpack_require__.e(/* import() */ "bar_js").then(__webpack_require__.bind(__webpack_require__, "./bar.js")).then((mod)=>{ console.log(mod); }); const a = "a"; diff --git a/packages/rspack-test-tools/tests/treeShakingCases/tree-shaking-interop/snapshot/output.snap.txt b/packages/rspack-test-tools/tests/treeShakingCases/tree-shaking-interop/snapshot/output.snap.txt index fbdcdc341b1..d859f18d6bc 100644 --- a/packages/rspack-test-tools/tests/treeShakingCases/tree-shaking-interop/snapshot/output.snap.txt +++ b/packages/rspack-test-tools/tests/treeShakingCases/tree-shaking-interop/snapshot/output.snap.txt @@ -20,7 +20,7 @@ __webpack_require__.r(__webpack_exports__); __webpack_require__.d(__webpack_exports__, { a: function() { return a; } }); -__webpack_require__.e("bar_js").then(__webpack_require__.bind(__webpack_require__, "./bar.js")).then((mod)=>{ +__webpack_require__.e(/* import() */ "bar_js").then(__webpack_require__.bind(__webpack_require__, "./bar.js")).then((mod)=>{ console.log(mod); }); const a = "a"; diff --git a/packages/rspack-test-tools/tests/treeShakingCases/tree-shaking-lazy-import/snapshot/new_treeshaking.snap.txt b/packages/rspack-test-tools/tests/treeShakingCases/tree-shaking-lazy-import/snapshot/new_treeshaking.snap.txt index 3b320bb68a8..5c810cb6c5a 100644 --- a/packages/rspack-test-tools/tests/treeShakingCases/tree-shaking-lazy-import/snapshot/new_treeshaking.snap.txt +++ b/packages/rspack-test-tools/tests/treeShakingCases/tree-shaking-lazy-import/snapshot/new_treeshaking.snap.txt @@ -32,7 +32,7 @@ const answer = 30; "use strict"; /* harmony import */var _app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./app.js"); -const a = test(()=>__webpack_require__.e("lib_js").then(__webpack_require__.bind(__webpack_require__, "./lib.js"))); +const a = test(()=>__webpack_require__.e(/* import() */ "lib_js").then(__webpack_require__.bind(__webpack_require__, "./lib.js"))); (0, _app__WEBPACK_IMPORTED_MODULE_0__.answer)(); a; }), diff --git a/packages/rspack-test-tools/tests/treeShakingCases/tree-shaking-lazy-import/snapshot/output.snap.txt b/packages/rspack-test-tools/tests/treeShakingCases/tree-shaking-lazy-import/snapshot/output.snap.txt index 92e2ab61739..cb8d2a5ac86 100644 --- a/packages/rspack-test-tools/tests/treeShakingCases/tree-shaking-lazy-import/snapshot/output.snap.txt +++ b/packages/rspack-test-tools/tests/treeShakingCases/tree-shaking-lazy-import/snapshot/output.snap.txt @@ -35,7 +35,7 @@ const answer = 30; __webpack_require__.r(__webpack_exports__); /* harmony import */var _app__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./app.js"); -const a = test(()=>__webpack_require__.e("lib_js").then(__webpack_require__.bind(__webpack_require__, "./lib.js"))); +const a = test(()=>__webpack_require__.e(/* import() */ "lib_js").then(__webpack_require__.bind(__webpack_require__, "./lib.js"))); (0, _app__WEBPACK_IMPORTED_MODULE_0__.answer)(); a; }), diff --git a/packages/rspack-test-tools/tests/treeShakingCases/webpack-inner-graph-switch/snapshot/new_treeshaking.snap.txt b/packages/rspack-test-tools/tests/treeShakingCases/webpack-inner-graph-switch/snapshot/new_treeshaking.snap.txt index 93eeddef92b..a52e852e672 100644 --- a/packages/rspack-test-tools/tests/treeShakingCases/webpack-inner-graph-switch/snapshot/new_treeshaking.snap.txt +++ b/packages/rspack-test-tools/tests/treeShakingCases/webpack-inner-graph-switch/snapshot/new_treeshaking.snap.txt @@ -28,8 +28,8 @@ function test() { it("should generate correct code when pure expressions are in dead branches", ()=>{ __webpack_require__("./import-module.js")/* .test */.test(); return Promise.all([ - Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "./some-module.js")), - __webpack_require__.e("chunk_js").then(__webpack_require__.bind(__webpack_require__, "./chunk.js")) + Promise.resolve(/* import() */ ).then(__webpack_require__.bind(__webpack_require__, "./some-module.js")), + __webpack_require__.e(/* import() */ "chunk_js").then(__webpack_require__.bind(__webpack_require__, "./chunk.js")) ]); }); }), diff --git a/packages/rspack-test-tools/tests/treeShakingCases/webpack-inner-graph-switch/snapshot/output.snap.txt b/packages/rspack-test-tools/tests/treeShakingCases/webpack-inner-graph-switch/snapshot/output.snap.txt index cbfb60a4820..953098a5583 100644 --- a/packages/rspack-test-tools/tests/treeShakingCases/webpack-inner-graph-switch/snapshot/output.snap.txt +++ b/packages/rspack-test-tools/tests/treeShakingCases/webpack-inner-graph-switch/snapshot/output.snap.txt @@ -30,8 +30,8 @@ function test() { it("should generate correct code when pure expressions are in dead branches", ()=>{ __webpack_require__("./import-module.js")/* .test */.test(); return Promise.all([ - Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "./some-module.js")), - __webpack_require__.e("chunk_js").then(__webpack_require__.bind(__webpack_require__, "./chunk.js")) + Promise.resolve(/* import() */ ).then(__webpack_require__.bind(__webpack_require__, "./some-module.js")), + __webpack_require__.e(/* import() */ "chunk_js").then(__webpack_require__.bind(__webpack_require__, "./chunk.js")) ]); }); }), diff --git a/packages/rspack-test-tools/tests/treeShakingCases/webpack-innergraph-circular/snapshot/new_treeshaking.snap.txt b/packages/rspack-test-tools/tests/treeShakingCases/webpack-innergraph-circular/snapshot/new_treeshaking.snap.txt index 60b5053f55a..bb30cb6890b 100644 --- a/packages/rspack-test-tools/tests/treeShakingCases/webpack-innergraph-circular/snapshot/new_treeshaking.snap.txt +++ b/packages/rspack-test-tools/tests/treeShakingCases/webpack-innergraph-circular/snapshot/new_treeshaking.snap.txt @@ -23,7 +23,7 @@ it("export should be unused when only unused functions use it", ()=>{ expect(_inner__WEBPACK_IMPORTED_MODULE_0__.exportAUsed).toBe(true); expect(_inner__WEBPACK_IMPORTED_MODULE_0__.exportBUsed).toBe(true); expect(_inner__WEBPACK_IMPORTED_MODULE_0__.exportCUsed).toBe(false); - return __webpack_require__.e("chunk_js").then(__webpack_require__.bind(__webpack_require__, "./chunk.js")); + return __webpack_require__.e(/* import() */ "chunk_js").then(__webpack_require__.bind(__webpack_require__, "./chunk.js")); }); }), "./inner.js": (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) { diff --git a/packages/rspack-test-tools/tests/treeShakingCases/webpack-innergraph-circular/snapshot/output.snap.txt b/packages/rspack-test-tools/tests/treeShakingCases/webpack-innergraph-circular/snapshot/output.snap.txt index 9c1b9081d9c..be1450bac13 100644 --- a/packages/rspack-test-tools/tests/treeShakingCases/webpack-innergraph-circular/snapshot/output.snap.txt +++ b/packages/rspack-test-tools/tests/treeShakingCases/webpack-innergraph-circular/snapshot/output.snap.txt @@ -24,7 +24,7 @@ it("export should be unused when only unused functions use it", ()=>{ expect(_inner__WEBPACK_IMPORTED_MODULE_0__.exportAUsed).toBe(true); expect(_inner__WEBPACK_IMPORTED_MODULE_0__.exportBUsed).toBe(true); expect(_inner__WEBPACK_IMPORTED_MODULE_0__.exportCUsed).toBe(false); - return __webpack_require__.e("chunk_js").then(__webpack_require__.bind(__webpack_require__, "./chunk.js")); + return __webpack_require__.e(/* import() */ "chunk_js").then(__webpack_require__.bind(__webpack_require__, "./chunk.js")); }); }), "./inner.js": (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) { diff --git a/plugin-test/css-extract/cases/chunkFilename-fullhash/expected/async.$e922852729b051304a06$.css b/plugin-test/css-extract/cases/chunkFilename-fullhash/expected/async.$a86b1707b4af75e0f088$.css similarity index 100% rename from plugin-test/css-extract/cases/chunkFilename-fullhash/expected/async.$e922852729b051304a06$.css rename to plugin-test/css-extract/cases/chunkFilename-fullhash/expected/async.$a86b1707b4af75e0f088$.css diff --git a/plugin-test/css-extract/cases/chunkFilename-fullhash/expected/main.$e922852729b051304a06$.css b/plugin-test/css-extract/cases/chunkFilename-fullhash/expected/main.$a86b1707b4af75e0f088$.css similarity index 100% rename from plugin-test/css-extract/cases/chunkFilename-fullhash/expected/main.$e922852729b051304a06$.css rename to plugin-test/css-extract/cases/chunkFilename-fullhash/expected/main.$a86b1707b4af75e0f088$.css diff --git a/plugin-test/css-extract/cases/chunkFilename-fullhash/expected/main.js b/plugin-test/css-extract/cases/chunkFilename-fullhash/expected/main.js index 10da130ed50..a59b5770bff 100644 --- a/plugin-test/css-extract/cases/chunkFilename-fullhash/expected/main.js +++ b/plugin-test/css-extract/cases/chunkFilename-fullhash/expected/main.js @@ -11,7 +11,7 @@ __webpack_require__.r(__webpack_exports__); __webpack_require__.r(__webpack_exports__); /* harmony import */var _style_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./style.css?b16f"); -/* eslint-disable-next-line no-unused-expressions */ __webpack_require__.e("async").then(__webpack_require__.bind(__webpack_require__, "./async.css?833a")); +/* eslint-disable-next-line no-unused-expressions */ __webpack_require__.e(/* import() | async */ "async").then(__webpack_require__.bind(__webpack_require__, "./async.css?833a")); }), } @@ -75,7 +75,7 @@ __webpack_require__.e = function (chunkId) { // webpack/runtime/get_full_hash !function() { __webpack_require__.h = function () { - return "e922852729b051304a06"; + return "a86b1707b4af75e0f088"; }; }(); diff --git a/plugin-test/css-extract/cases/insert-function/expected/main.js b/plugin-test/css-extract/cases/insert-function/expected/main.js index c1fc7331d8b..fcc5809d4e8 100644 --- a/plugin-test/css-extract/cases/insert-function/expected/main.js +++ b/plugin-test/css-extract/cases/insert-function/expected/main.js @@ -2,7 +2,7 @@ var __webpack_modules__ = { "./src/index.js": (function (__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { /* eslint-env browser */ // eslint-disable-next-line -__webpack_require__.e("src_inject_css").then(__webpack_require__.bind(__webpack_require__, "./src/inject.css?901b")); +__webpack_require__.e(/* import() */ "src_inject_css").then(__webpack_require__.bind(__webpack_require__, "./src/inject.css?901b")); }), } diff --git a/plugin-test/css-extract/cases/insert-string/expected/main.js b/plugin-test/css-extract/cases/insert-string/expected/main.js index 7093c0e4169..016b356153f 100644 --- a/plugin-test/css-extract/cases/insert-string/expected/main.js +++ b/plugin-test/css-extract/cases/insert-string/expected/main.js @@ -2,7 +2,7 @@ var __webpack_modules__ = { "./src/index.js": (function (__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { /* eslint-env browser */ // eslint-disable-next-line -__webpack_require__.e("src_inject_css").then(__webpack_require__.bind(__webpack_require__, "./src/inject.css?901b")); +__webpack_require__.e(/* import() */ "src_inject_css").then(__webpack_require__.bind(__webpack_require__, "./src/inject.css?901b")); }), } diff --git a/plugin-test/css-extract/cases/insert-undefined/expected/main.js b/plugin-test/css-extract/cases/insert-undefined/expected/main.js index 8bc15bed246..5367068a823 100644 --- a/plugin-test/css-extract/cases/insert-undefined/expected/main.js +++ b/plugin-test/css-extract/cases/insert-undefined/expected/main.js @@ -2,7 +2,7 @@ var __webpack_modules__ = { "./src/index.js": (function (__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { /* eslint-env browser */ // eslint-disable-next-line -__webpack_require__.e("src_inject_css").then(__webpack_require__.bind(__webpack_require__, "./src/inject.css?901b")); +__webpack_require__.e(/* import() */ "src_inject_css").then(__webpack_require__.bind(__webpack_require__, "./src/inject.css?901b")); }), } diff --git a/plugin-test/css-extract/cases/no-runtime/expected/main.js b/plugin-test/css-extract/cases/no-runtime/expected/main.js index b09bb6611b2..bce48185d9a 100644 --- a/plugin-test/css-extract/cases/no-runtime/expected/main.js +++ b/plugin-test/css-extract/cases/no-runtime/expected/main.js @@ -11,7 +11,7 @@ __webpack_require__.r(__webpack_exports__); __webpack_require__.r(__webpack_exports__); /* harmony import */var _style_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./style.css?b16f"); -__webpack_require__.e("async").then(__webpack_require__.bind(__webpack_require__, "./async.css?833a")); +__webpack_require__.e(/* import() | async */ "async").then(__webpack_require__.bind(__webpack_require__, "./async.css?833a")); }), }