diff --git a/crates/rspack_core/src/concatenated_module.rs b/crates/rspack_core/src/concatenated_module.rs index 3f754c118a3..b4f2e4eb9b6 100644 --- a/crates/rspack_core/src/concatenated_module.rs +++ b/crates/rspack_core/src/concatenated_module.rs @@ -977,7 +977,7 @@ impl Module for ConcatenatedModule { let mut result = ConcatSource::default(); let mut should_add_harmony_flag = false; - // Add harmony compatibility flag (must be first because of possible circular dependencies) + // Add ESM compatibility flag (must be first because of possible circular dependencies) if compilation .get_module_graph() .get_exports_info(&self.id()) diff --git a/crates/rspack_plugin_javascript/src/dependency/esm/harmony_export_imported_specifier_dependency.rs b/crates/rspack_plugin_javascript/src/dependency/esm/harmony_export_imported_specifier_dependency.rs index 4706a166b34..2a2d93bf5b0 100644 --- a/crates/rspack_plugin_javascript/src/dependency/esm/harmony_export_imported_specifier_dependency.rs +++ b/crates/rspack_plugin_javascript/src/dependency/esm/harmony_export_imported_specifier_dependency.rs @@ -858,9 +858,9 @@ impl HarmonyExportImportedSpecifierDependency { ) -> Option> { let create_error = |message: String| { let (severity, title) = if should_error { - (Severity::Error, "HarmonyLinkingError") + (Severity::Error, "ESModulesLinkingError") } else { - (Severity::Warning, "HarmonyLinkingWarning") + (Severity::Warning, "ESModulesLinkingWarning") }; let parent_module_identifier = module_graph .get_parent_module(&self.id) diff --git a/crates/rspack_plugin_javascript/src/dependency/esm/harmony_import_dependency.rs b/crates/rspack_plugin_javascript/src/dependency/esm/harmony_import_dependency.rs index ab62ecb6fb0..a52bd0d014f 100644 --- a/crates/rspack_plugin_javascript/src/dependency/esm/harmony_import_dependency.rs +++ b/crates/rspack_plugin_javascript/src/dependency/esm/harmony_import_dependency.rs @@ -240,9 +240,9 @@ pub fn harmony_import_dependency_get_linking_error( ); let create_error = |message: String| { let (severity, title) = if should_error { - (Severity::Error, "HarmonyLinkingError") + (Severity::Error, "ESModulesLinkingError") } else { - (Severity::Warning, "HarmonyLinkingWarning") + (Severity::Warning, "ESModulesLinkingWarning") }; let mut diagnostic = if let Some(span) = module_dependency.range() && let Some(source) = parent_module.original_source().map(|s| s.source()) diff --git a/crates/rspack_plugin_javascript/src/parser_and_generator/mod.rs b/crates/rspack_plugin_javascript/src/parser_and_generator/mod.rs index 3755aae74dc..e4f63bcc916 100644 --- a/crates/rspack_plugin_javascript/src/parser_and_generator/mod.rs +++ b/crates/rspack_plugin_javascript/src/parser_and_generator/mod.rs @@ -340,7 +340,7 @@ impl ParserAndGenerator for JavaScriptParserAndGenerator { _mg: &ModuleGraph, _cg: &ChunkGraph, ) -> Option> { - // Only harmony modules are valid for optimization + // Only ES modules are valid for optimization if module.build_meta().is_none() || module .build_meta() diff --git a/crates/rspack_plugin_runtime/src/runtime_module/runtime/harmony_module_decorator.js b/crates/rspack_plugin_runtime/src/runtime_module/runtime/harmony_module_decorator.js index fcd475149e9..8c9f2085b68 100644 --- a/crates/rspack_plugin_runtime/src/runtime_module/runtime/harmony_module_decorator.js +++ b/crates/rspack_plugin_runtime/src/runtime_module/runtime/harmony_module_decorator.js @@ -4,7 +4,7 @@ __webpack_require__.hmd = function (module) { Object.defineProperty(module, 'exports', { enumerable: true, set: function () { - throw new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id); + throw new Error('ES modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id); } }); return module; diff --git a/packages/rspack-test-tools/tests/__snapshots__/Config.test.js.snap b/packages/rspack-test-tools/tests/__snapshots__/Config.test.js.snap index 1edaecfe285..70b70ad656a 100644 --- a/packages/rspack-test-tools/tests/__snapshots__/Config.test.js.snap +++ b/packages/rspack-test-tools/tests/__snapshots__/Config.test.js.snap @@ -551,7 +551,7 @@ const value = foo + (bar_default()) export { value }; `; -exports[`config config/library/modern-module-force-concaten step should pass: harmony export should concat 1`] = ` +exports[`config config/library/modern-module-force-concaten step should pass: ESM export should concat 1`] = ` ;// CONCATENATED MODULE: ./a.js const a = 'a' diff --git a/packages/rspack-test-tools/tests/configCases/library/modern-module-force-concaten/rspack.config.js b/packages/rspack-test-tools/tests/configCases/library/modern-module-force-concaten/rspack.config.js index 32266e35d00..cb33214647c 100644 --- a/packages/rspack-test-tools/tests/configCases/library/modern-module-force-concaten/rspack.config.js +++ b/packages/rspack-test-tools/tests/configCases/library/modern-module-force-concaten/rspack.config.js @@ -33,7 +33,7 @@ module.exports = { */ const handler = compilation => { compilation.hooks.afterProcessAssets.tap("testcase", assets => { - expect(assets['a.js']._value).toMatchSnapshot("harmony export should concat"); + expect(assets['a.js']._value).toMatchSnapshot("ESM export should concat"); expect(assets['b.js']._value).toMatchSnapshot(".cjs should bail out"); expect(assets['c.js']._value).toMatchSnapshot("unambiguous should bail out"); expect(assets['d.js']._value).toMatchSnapshot(".mjs should concat"); diff --git a/packages/rspack-test-tools/tests/normalCases/errors/harmony-export-default-from/index.js b/packages/rspack-test-tools/tests/normalCases/errors/harmony-export-default-from/index.js index e5969e1a3f9..f9d4f53011c 100644 --- a/packages/rspack-test-tools/tests/normalCases/errors/harmony-export-default-from/index.js +++ b/packages/rspack-test-tools/tests/normalCases/errors/harmony-export-default-from/index.js @@ -1,3 +1,3 @@ -it("should throw if harmony export default from is used", () => { +it("should throw if ESM export default from is used", () => { expect(() => require("./foo")).toThrowError(/Module parse failed/); }); diff --git a/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm1.js b/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm1.js index f09dafd9d91..65238a1d5cc 100644 --- a/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm1.js +++ b/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm1.js @@ -1,6 +1,6 @@ import "./bbb"; -it("should decorate esm and commonjs mix with harmony module decorator when assign to module.exports", function () { +it("should decorate esm and commonjs mix with ES modules decorator when assign to module.exports", function () { expect(function () { module.exports = 1; }).toThrowError(); diff --git a/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm2.js b/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm2.js index 9e83415ea05..072733ebb72 100644 --- a/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm2.js +++ b/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm2.js @@ -2,7 +2,7 @@ import "./bbb"; module = 1; -it("should decorate esm and commonjs mix with harmony module decorator when assign to module", function () { +it("should decorate esm and commonjs mix with ES modules decorator when assign to module", function () { expect(function () { __webpack_module__.exports = 1; }).toThrowError(); diff --git a/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm3.js b/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm3.js index da70c45b017..dfe609852e8 100644 --- a/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm3.js +++ b/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm3.js @@ -2,7 +2,7 @@ import "./bbb"; module.__esModule = 1; -it("should decorate esm and commonjs mix with harmony module decorator when assign to module._esModule", function () { +it("should decorate esm and commonjs mix with ES modules decorator when assign to module._esModule", function () { expect(function () { __webpack_module__.exports = 1; }).toThrowError(); diff --git a/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm4.js b/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm4.js index 55a80dad12f..e00751784e9 100644 --- a/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm4.js +++ b/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm4.js @@ -2,7 +2,7 @@ import "./bbb"; Object.keys(module); -it("should decorate esm and commonjs mix with harmony module decorator when access module", function () { +it("should decorate esm and commonjs mix with ES modules decorator when access module", function () { expect(function () { __webpack_module__.exports = 1; }).toThrowError(); diff --git a/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm5.js b/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm5.js index 59be4fa4f57..67d45085ff4 100644 --- a/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm5.js +++ b/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm5.js @@ -1,6 +1,6 @@ import "./bbb"; -it("should decorate esm and commonjs mix with harmony module decorator when Object.defineProperty(module, 'exports', xxx);", function () { +it("should decorate esm and commonjs mix with ES modules decorator when Object.defineProperty(module, 'exports', xxx);", function () { expect(function () { Object.defineProperty(module, "exports", 1); }).toThrowError(); diff --git a/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm6.js b/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm6.js index 75bf868df68..3b7affcfda6 100644 --- a/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm6.js +++ b/packages/rspack-test-tools/tests/normalCases/parsing/harmony-commonjs-mix-decorator/esm6.js @@ -2,7 +2,7 @@ import "./bbb"; module.xxx = 1; -it("should decorate esm and commonjs mix with harmony module decorator when assign to module.xxx", function () { +it("should decorate esm and commonjs mix with ES modules decorator when assign to module.xxx", function () { expect(function () { __webpack_module__.exports = 1; }).toThrowError(); diff --git a/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm1.js b/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm1.js index f09dafd9d91..65238a1d5cc 100644 --- a/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm1.js +++ b/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm1.js @@ -1,6 +1,6 @@ import "./bbb"; -it("should decorate esm and commonjs mix with harmony module decorator when assign to module.exports", function () { +it("should decorate esm and commonjs mix with ES modules decorator when assign to module.exports", function () { expect(function () { module.exports = 1; }).toThrowError(); diff --git a/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm2.js b/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm2.js index 9e83415ea05..072733ebb72 100644 --- a/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm2.js +++ b/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm2.js @@ -2,7 +2,7 @@ import "./bbb"; module = 1; -it("should decorate esm and commonjs mix with harmony module decorator when assign to module", function () { +it("should decorate esm and commonjs mix with ES modules decorator when assign to module", function () { expect(function () { __webpack_module__.exports = 1; }).toThrowError(); diff --git a/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm3.js b/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm3.js index da70c45b017..dfe609852e8 100644 --- a/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm3.js +++ b/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm3.js @@ -2,7 +2,7 @@ import "./bbb"; module.__esModule = 1; -it("should decorate esm and commonjs mix with harmony module decorator when assign to module._esModule", function () { +it("should decorate esm and commonjs mix with ES modules decorator when assign to module._esModule", function () { expect(function () { __webpack_module__.exports = 1; }).toThrowError(); diff --git a/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm4.js b/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm4.js index ce231863e80..2b1527eabe4 100644 --- a/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm4.js +++ b/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm4.js @@ -1,6 +1,6 @@ import "./bbb"; -it("should decorate esm and commonjs mix with harmony module decorator when access module", function () { +it("should decorate esm and commonjs mix with ES modules decorator when access module", function () { expect(function () { __webpack_module__.exports = 1; }).toThrowError(); diff --git a/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm5.js b/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm5.js index 59be4fa4f57..67d45085ff4 100644 --- a/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm5.js +++ b/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm5.js @@ -1,6 +1,6 @@ import "./bbb"; -it("should decorate esm and commonjs mix with harmony module decorator when Object.defineProperty(module, 'exports', xxx);", function () { +it("should decorate esm and commonjs mix with ES modules decorator when Object.defineProperty(module, 'exports', xxx);", function () { expect(function () { Object.defineProperty(module, "exports", 1); }).toThrowError(); diff --git a/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm6.js b/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm6.js index 75bf868df68..3b7affcfda6 100644 --- a/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm6.js +++ b/packages/rspack-test-tools/tests/runtimeDiffCases/module-interop/esm-cjs-mix/src/mix/esm6.js @@ -2,7 +2,7 @@ import "./bbb"; module.xxx = 1; -it("should decorate esm and commonjs mix with harmony module decorator when assign to module.xxx", function () { +it("should decorate esm and commonjs mix with ES modules decorator when assign to module.xxx", function () { expect(function () { __webpack_module__.exports = 1; }).toThrowError(); diff --git a/packages/rspack/src/RuntimeGlobals.ts b/packages/rspack/src/RuntimeGlobals.ts index c129e3571a0..3516546b6df 100644 --- a/packages/rspack/src/RuntimeGlobals.ts +++ b/packages/rspack/src/RuntimeGlobals.ts @@ -169,7 +169,7 @@ export const RuntimeGlobals = { compatGetDefaultExport: "__webpack_require__.n", /** - * harmony module decorator + * ES modules decorator */ harmonyModuleDecorator: "__webpack_require__.hmd", diff --git a/tests/webpack-examples/build-http/README.md b/tests/webpack-examples/build-http/README.md index 725256ad2de..94a1b910de0 100644 --- a/tests/webpack-examples/build-http/README.md +++ b/tests/webpack-examples/build-http/README.md @@ -42,7 +42,7 @@ modules by path https:// 30 KiB https://unpkg.com/p-map-series?module 263 bytes [built] [code generated] [exports: default] [used exports unknown] - harmony side effect evaluation https://unpkg.com/p-map-series?module ./example.js 4:0-58 + ESM side effect evaluation https://unpkg.com/p-map-series?module ./example.js 4:0-58 ESM import specifier https://unpkg.com/p-map-series?module ./example.js 8:12-17 ./example.js 314 bytes [built] [code generated] [no exports] diff --git a/tests/webpack-examples/code-splitting-depend-on-advanced/README.md b/tests/webpack-examples/code-splitting-depend-on-advanced/README.md index 071ef57aa97..a737a63f4f7 100644 --- a/tests/webpack-examples/code-splitting-depend-on-advanced/README.md +++ b/tests/webpack-examples/code-splitting-depend-on-advanced/README.md @@ -589,21 +589,21 @@ chunk (runtime: runtime) react-vendors.js (react-vendors) 87 bytes ={runtime}= > ./node_modules/prop-types.js 31 bytes [built] [code generated] [used exports unknown] from origin ./lazy.js - harmony side effect evaluation prop-types ./lazy.js 2:0-35 + ESM side effect evaluation prop-types ./lazy.js 2:0-35 ESM 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 + ESM side effect evaluation react-dom ./page1.js 3:0-33 ESM import specifier react-dom ./page1.js 5:36-44 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] from origin ./page1.js - harmony side effect evaluation react ./page1.js 2:0-26 + ESM side effect evaluation react ./page1.js 2:0-26 ESM import specifier react ./page1.js 5:29-34 cjs self exports reference ./node_modules/react.js 1:0-14 entry react react-vendors @@ -660,21 +660,21 @@ chunk (runtime: runtime) react-vendors.js (react-vendors) 87 bytes ={runtime}= > ./node_modules/prop-types.js 31 bytes [built] [code generated] [used exports unknown] from origin ./lazy.js - harmony side effect evaluation prop-types ./lazy.js 2:0-35 + ESM side effect evaluation prop-types ./lazy.js 2:0-35 ESM 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 + ESM side effect evaluation react-dom ./page1.js 3:0-33 ESM import specifier react-dom ./page1.js 5:36-44 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] from origin ./page1.js - harmony side effect evaluation react ./page1.js 2:0-26 + ESM side effect evaluation react ./page1.js 2:0-26 ESM import specifier react ./page1.js 5:29-34 cjs self exports reference ./node_modules/react.js 1:0-14 entry react react-vendors diff --git a/tests/webpack-examples/code-splitting-depend-on-simple/README.md b/tests/webpack-examples/code-splitting-depend-on-simple/README.md index a8b37c9c791..96478735259 100644 --- a/tests/webpack-examples/code-splitting-depend-on-simple/README.md +++ b/tests/webpack-examples/code-splitting-depend-on-simple/README.md @@ -312,21 +312,21 @@ chunk (runtime: react-vendors) react-vendors.js (react-vendors) 87 bytes (javasc ./node_modules/prop-types.js 31 bytes [built] [code generated] [used exports unknown] from origin ./app.js - harmony side effect evaluation prop-types ./app.js 3:0-35 + ESM side effect evaluation prop-types ./app.js 3:0-35 ESM 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] from origin ./app.js - harmony side effect evaluation react-dom ./app.js 2:0-33 + ESM side effect evaluation react-dom ./app.js 2:0-33 ESM 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] from origin ./app.js - harmony side effect evaluation react ./app.js 1:0-26 + ESM side effect evaluation react ./app.js 1:0-26 ESM import specifier react ./app.js 5:12-17 cjs self exports reference ./node_modules/react.js 1:0-14 entry react react-vendors @@ -353,21 +353,21 @@ chunk (runtime: react-vendors) react-vendors.js (react-vendors) 87 bytes (javasc ./node_modules/prop-types.js 31 bytes [built] [code generated] [used exports unknown] from origin ./app.js - harmony side effect evaluation prop-types ./app.js 3:0-35 + ESM side effect evaluation prop-types ./app.js 3:0-35 ESM 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] from origin ./app.js - harmony side effect evaluation react-dom ./app.js 2:0-33 + ESM side effect evaluation react-dom ./app.js 2:0-33 ESM 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] from origin ./app.js - harmony side effect evaluation react ./app.js 1:0-26 + ESM side effect evaluation react ./app.js 1:0-26 ESM import specifier react ./app.js 5:12-17 cjs self exports reference ./node_modules/react.js 1:0-14 entry react react-vendors diff --git a/tests/webpack-test/configCases/dll-plugin-entry/1-use-dll/index.js b/tests/webpack-test/configCases/dll-plugin-entry/1-use-dll/index.js index 535df50edf1..c9818abdef7 100644 --- a/tests/webpack-test/configCases/dll-plugin-entry/1-use-dll/index.js +++ b/tests/webpack-test/configCases/dll-plugin-entry/1-use-dll/index.js @@ -4,11 +4,11 @@ it("should load a module from dll", function() { expect(require("dll/index")).toEqual(nsObj({ bar: "bar", default: 42 })); }); -it("should load an harmony module from dll (default export)", function() { +it("should load an ES module from dll (default export)", function() { expect(Answer).toBe(42); }); -it("should load an harmony module from dll (star export)", function() { +it("should load an ES module from dll (star export)", function() { expect(bar).toBe("bar"); }); diff --git a/tests/webpack-test/configCases/dll-plugin/1-use-dll/index.js b/tests/webpack-test/configCases/dll-plugin/1-use-dll/index.js index 638fe966db9..18431f91483 100644 --- a/tests/webpack-test/configCases/dll-plugin/1-use-dll/index.js +++ b/tests/webpack-test/configCases/dll-plugin/1-use-dll/index.js @@ -20,11 +20,11 @@ it("should load an async module from dll", function(done) { .catch(done); }); -it("should load an harmony module from dll (default export)", function() { +it("should load an ES module from dll (default export)", function() { expect(d).toBe("d"); }); -it("should load an harmony module from dll (star export)", function() { +it("should load an ES module from dll (star export)", function() { expect(x1).toBe(123); expect(x2).toBe(123); expect(y1).toBe(456); diff --git a/tests/webpack-test/configCases/dll-plugin/2-use-dll-without-scope/index.js b/tests/webpack-test/configCases/dll-plugin/2-use-dll-without-scope/index.js index 70482da8fdc..982e5787975 100644 --- a/tests/webpack-test/configCases/dll-plugin/2-use-dll-without-scope/index.js +++ b/tests/webpack-test/configCases/dll-plugin/2-use-dll-without-scope/index.js @@ -21,11 +21,11 @@ it("should load an async module from dll", function (done) { .catch(done); }); -it("should load an harmony module from dll (default export)", function () { +it("should load an ES module from dll (default export)", function () { expect(d).toBe("d"); }); -it("should load an harmony module from dll (star export)", function () { +it("should load an ES module from dll (star export)", function () { expect(x1).toBe(123); expect(x2).toBe(123); expect(y1).toBe(456); diff --git a/tests/webpack-test/configCases/dll-plugin/3-use-dll-with-hashid/index.js b/tests/webpack-test/configCases/dll-plugin/3-use-dll-with-hashid/index.js index 224bc015e73..d4fe59e07e7 100644 --- a/tests/webpack-test/configCases/dll-plugin/3-use-dll-with-hashid/index.js +++ b/tests/webpack-test/configCases/dll-plugin/3-use-dll-with-hashid/index.js @@ -13,11 +13,11 @@ it("should load an async module from dll", function(done) { }).catch(done); }); -it("should load an harmony module from dll (default export)", function() { +it("should load an ES module from dll (default export)", function() { expect(d).toBe("d"); }); -it("should load an harmony module from dll (star export)", function() { +it("should load an ES module from dll (star export)", function() { expect(x1).toBe(123); expect(x2).toBe(123); expect(y1).toBe(456); diff --git a/tests/webpack-test/configCases/parsing/harmony-this-concat/index.js b/tests/webpack-test/configCases/parsing/harmony-this-concat/index.js index e4ecf860e0a..7e78fdc41db 100644 --- a/tests/webpack-test/configCases/parsing/harmony-this-concat/index.js +++ b/tests/webpack-test/configCases/parsing/harmony-this-concat/index.js @@ -6,7 +6,7 @@ import {bindThis, callThis, applyThis} from "./issue-7213"; import * as abc from "./abc"; -it("should have this = undefined on harmony modules", () => { +it("should have this = undefined on ES modules", () => { expect((typeof that)).toBe("undefined"); expect((typeof abc.that)).toBe("undefined"); expect((typeof returnThisArrow())).toBe("undefined"); diff --git a/tests/webpack-test/configCases/parsing/harmony-this/index.js b/tests/webpack-test/configCases/parsing/harmony-this/index.js index 531f7a7bef5..daf51814df8 100644 --- a/tests/webpack-test/configCases/parsing/harmony-this/index.js +++ b/tests/webpack-test/configCases/parsing/harmony-this/index.js @@ -6,7 +6,7 @@ import {bindThis, callThis, applyThis} from "./issue-7213"; import * as abc from "./abc"; -it("should have this = undefined on harmony modules", () => { +it("should have this = undefined on ES modules", () => { expect((typeof that)).toBe("undefined"); expect((typeof abc.that)).toBe("undefined"); expect((typeof returnThisArrow())).toBe("undefined"); diff --git a/tests/webpack-test/configCases/runtime/invalid-esm-export/index.js b/tests/webpack-test/configCases/runtime/invalid-esm-export/index.js index a25f46d5973..dd6868f804d 100644 --- a/tests/webpack-test/configCases/runtime/invalid-esm-export/index.js +++ b/tests/webpack-test/configCases/runtime/invalid-esm-export/index.js @@ -2,6 +2,6 @@ it("should throw exception when module.exports is assigned in es module", functi expect(function() { require("./esm-import-cjs-export"); }).toThrowError( - 'ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ./esm-import-cjs-export.js' + 'ES modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ./esm-import-cjs-export.js' ); }); diff --git a/tests/webpack-test/statsCases/graph-correctness-modules/test.config.js b/tests/webpack-test/statsCases/graph-correctness-modules/test.config.js index 34e3279a78c..bde518ced2e 100644 --- a/tests/webpack-test/statsCases/graph-correctness-modules/test.config.js +++ b/tests/webpack-test/statsCases/graph-correctness-modules/test.config.js @@ -21,8 +21,8 @@ module.exports = { - ./module-a.js XX bytes [built] [code generated] - import() ./module-a ./eXX.js - import() ./module-a ./module-c.js - + harmony side effect evaluation ./module-x ./eXX.js XX:XX-XX - + harmony side effect evaluation ./module-x ./eXX.js XX:XX-XX + + ESM side effect evaluation ./module-x ./eXX.js XX:XX-XX + + ESM side effect evaluation ./module-x ./eXX.js XX:XX-XX + import() ./module-x ./module-b.js XX:XX-XX @@ -14,5 +12,1 @@ - import() ./module-b ./module-a.js @@ -41,8 +41,8 @@ module.exports = { - esm import ./module-x ./eXX.js - esm import ./module-x ./eXX.js - import() ./module-x ./module-b.js - + harmony side effect evaluation ./module-x ./eXX.js XX:XX-XX - + harmony side effect evaluation ./module-x ./eXX.js XX:XX-XX + + ESM side effect evaluation ./module-x ./eXX.js XX:XX-XX + + ESM side effect evaluation ./module-x ./eXX.js XX:XX-XX + import() ./module-x ./module-b.js XX:XX-XX + chunk (runtime: eXX, eXX) c.js (c) XX bytes <{XX}> <{XX}> >{XX}< [rendered] + ./module-c.js XX bytes [built] [code generated] diff --git a/tests/webpack-test/statsCases/side-effects-issue-7428/test.config.js b/tests/webpack-test/statsCases/side-effects-issue-7428/test.config.js index 178ace1ee0f..6f21a661517 100644 --- a/tests/webpack-test/statsCases/side-effects-issue-7428/test.config.js +++ b/tests/webpack-test/statsCases/side-effects-issue-7428/test.config.js @@ -14,11 +14,11 @@ module.exports = { - esm import specifier ./components ./main.js - esm import ./components ./main.js + [inactive] from origin ./main.js + XX modules - + [inactive] harmony side effect evaluation ./components ./main.js + XX modules ./main.js XX:XX-XX + + [inactive] ESM side effect evaluation ./components ./main.js + XX modules ./main.js XX:XX-XX + [inactive] ESM import specifier ./components ./main.js + XX modules ./main.js XX:XX-XX + [inactive] ESM import specifier ./components ./main.js + XX modules ./main.js XX:XX-XX + [inactive] from origin ./foo.js - + [inactive] harmony side effect evaluation ./components ./foo.js XX:XX-XX + + [inactive] ESM side effect evaluation ./components ./foo.js XX:XX-XX + [inactive] ESM import specifier ./components ./foo.js XX:XX-XX @@ -19,5 +21,6 @@ - esm export ./CompA ./components/src/CompAB/index.js @@ -27,9 +27,9 @@ module.exports = { - esm import specifier ./components ./foo.js - esm import specifier ./components ./main.js + [inactive] from origin ./components/src/CompAB/index.js - + [inactive] harmony side effect evaluation ./CompA ./components/src/CompAB/index.js XX:XX-XX - + [inactive] harmony export imported specifier ./CompA ./components/src/CompAB/index.js XX:XX-XX - + [inactive] harmony export imported specifier ./CompAB ./components/src/index.js XX:XX-XX (skipped side-effect-free modules) + + [inactive] ESM side effect evaluation ./CompA ./components/src/CompAB/index.js XX:XX-XX + + [inactive] ESM export imported specifier ./CompA ./components/src/CompAB/index.js XX:XX-XX + + [inactive] ESM export imported specifier ./CompAB ./components/src/index.js XX:XX-XX (skipped side-effect-free modules) + ESM import specifier ./components ./foo.js XX:XX-XX (skipped side-effect-free modules) + ESM import specifier ./components ./main.js + XX modules ./main.js XX:XX-XX (skipped side-effect-free modules) @@ -25,6 +28,9 @@ @@ -40,13 +40,13 @@ module.exports = { - esm import ./utils ./components/src/CompAB/CompB.js - esm import specifier ./utils ./components/src/CompAB/CompB.js + from origin ./components/src/CompAB/CompA.js - + [inactive] harmony side effect evaluation ./utils ./components/src/CompAB/CompA.js XX:XX-XX + + [inactive] ESM side effect evaluation ./utils ./components/src/CompAB/CompA.js XX:XX-XX + ESM import specifier ./utils ./components/src/CompAB/CompA.js XX:XX-XX + from origin ./components/src/CompAB/CompB.js - + [inactive] harmony side effect evaluation ./utils ./components/src/CompAB/CompB.js XX:XX-XX + + [inactive] ESM side effect evaluation ./utils ./components/src/CompAB/CompB.js XX:XX-XX + ESM import specifier ./utils ./components/src/CompAB/CompB.js XX:XX-XX + from origin ./main.js + XX modules - + [inactive] harmony side effect evaluation ./utils ./main.js + XX modules ./components/src/CompAB/CompB.js XX:XX-XX + + [inactive] ESM side effect evaluation ./utils ./main.js + XX modules ./components/src/CompAB/CompB.js XX:XX-XX + ESM import specifier ./utils ./main.js + XX modules ./components/src/CompAB/CompB.js XX:XX-XX @@ -32,3 +38,1 @@ - ./main.js XX bytes [orphan] [built] @@ -67,9 +67,9 @@ module.exports = { - | esm export import specifier ./CompAB ./components/src/index.js - | esm import specifier ./components ./main.js + | [inactive] from origin ./components/src/CompAB/index.js - + | [inactive] harmony side effect evaluation ./CompB ./components/src/CompAB/index.js XX:XX-XX - + | [inactive] harmony export imported specifier ./CompB ./components/src/CompAB/index.js XX:XX-XX - + | [inactive] harmony export imported specifier ./CompAB ./components/src/index.js XX:XX-XX (skipped side-effect-free modules) + + | [inactive] ESM side effect evaluation ./CompB ./components/src/CompAB/index.js XX:XX-XX + + | [inactive] ESM export imported specifier ./CompB ./components/src/CompAB/index.js XX:XX-XX + + | [inactive] ESM export imported specifier ./CompAB ./components/src/index.js XX:XX-XX (skipped side-effect-free modules) + | ESM import specifier ./components ./main.js XX:XX-XX (skipped side-effect-free modules) @@ -46,2 +51,2 @@ - import() ./foo ./main.js diff --git a/tests/webpack-test/statsCases/side-effects-simple-unused/test.config.js b/tests/webpack-test/statsCases/side-effects-simple-unused/test.config.js index 425d9001f5f..ce1217e1e0f 100644 --- a/tests/webpack-test/statsCases/side-effects-simple-unused/test.config.js +++ b/tests/webpack-test/statsCases/side-effects-simple-unused/test.config.js @@ -16,21 +16,21 @@ module.exports = { + | [no exports used] + | ./node_modules/pmodule/index.js XX bytes [built] + | [only some exports used: default] - + | [inactive] harmony side effect evaluation pmodule ./index.js XX:XX-XX + + | [inactive] ESM side effect evaluation pmodule ./index.js XX:XX-XX + | ESM import specifier pmodule ./index.js XX:XX-XX + | [inactive] ESM import specifier pmodule ./index.js XX:XX-XX + | ./node_modules/pmodule/c.js XX bytes [built] + | [only some exports used: z] + | [inactive] from origin ./node_modules/pmodule/b.js - + | [inactive] harmony side effect evaluation ./c ./node_modules/pmodule/b.js XX:XX-XX - + | [inactive] harmony export imported specifier ./c ./node_modules/pmodule/b.js XX:XX-XX + + | [inactive] ESM side effect evaluation ./c ./node_modules/pmodule/b.js XX:XX-XX + + | [inactive] ESM export imported specifier ./c ./node_modules/pmodule/b.js XX:XX-XX + | ESM import specifier pmodule ./index.js XX:XX-XX (skipped side-effect-free modules) - + | [inactive] harmony export imported specifier ./b ./node_modules/pmodule/index.js XX:XX-XX (skipped side-effect-free modules) + + | [inactive] ESM export imported specifier ./b ./node_modules/pmodule/index.js XX:XX-XX (skipped side-effect-free modules) @@ -5,3 +21,3 @@ - esm import pmodule ./index.js - esm import specifier pmodule ./index.js - esm import specifier pmodule ./index.js - + [inactive] harmony side effect evaluation pmodule ./index.js XX:XX-XX + + [inactive] ESM side effect evaluation pmodule ./index.js XX:XX-XX + ESM import specifier pmodule ./index.js XX:XX-XX + [inactive] ESM import specifier pmodule ./index.js XX:XX-XX @@ -10,3 +26,5 @@ @@ -38,21 +38,21 @@ module.exports = { - esm export ./c ./node_modules/pmodule/b.js - esm export import specifier ./c ./node_modules/pmodule/b.js + [inactive] from origin ./node_modules/pmodule/b.js - + [inactive] harmony side effect evaluation ./c ./node_modules/pmodule/b.js XX:XX-XX - + [inactive] harmony export imported specifier ./c ./node_modules/pmodule/b.js XX:XX-XX + + [inactive] ESM side effect evaluation ./c ./node_modules/pmodule/b.js XX:XX-XX + + [inactive] ESM export imported specifier ./c ./node_modules/pmodule/b.js XX:XX-XX + ESM import specifier pmodule ./index.js XX:XX-XX (skipped side-effect-free modules) - + [inactive] harmony export imported specifier ./b ./node_modules/pmodule/index.js XX:XX-XX (skipped side-effect-free modules) + + [inactive] ESM export imported specifier ./b ./node_modules/pmodule/index.js XX:XX-XX (skipped side-effect-free modules) @@ -15,4 +33,6 @@ - esm export ./a ./node_modules/pmodule/index.js - esm export import specifier ./a ./node_modules/pmodule/index.js - esm export ./a ./node_modules/pmodule/index.js - esm export import specifier ./a ./node_modules/pmodule/index.js + [inactive] from origin ./index.js + XX modules - + [inactive] harmony side effect evaluation ./a ./index.js + XX modules ./node_modules/pmodule/index.js XX:XX-XX - + [inactive] harmony export imported specifier ./a ./index.js + XX modules ./node_modules/pmodule/index.js XX:XX-XX + + [inactive] ESM side effect evaluation ./a ./index.js + XX modules ./node_modules/pmodule/index.js XX:XX-XX + + [inactive] ESM export imported specifier ./a ./index.js + XX modules ./node_modules/pmodule/index.js XX:XX-XX + [inactive] from origin ./node_modules/pmodule/index.js - + [inactive] harmony side effect evaluation ./a ./node_modules/pmodule/index.js XX:XX-XX - + [inactive] harmony export imported specifier ./a ./node_modules/pmodule/index.js XX:XX-XX + + [inactive] ESM side effect evaluation ./a ./node_modules/pmodule/index.js XX:XX-XX + + [inactive] ESM export imported specifier ./a ./node_modules/pmodule/index.js XX:XX-XX @@ -21,27 +41,11 @@ - esm export ./b ./node_modules/pmodule/index.js - esm export import specifier ./b ./node_modules/pmodule/index.js @@ -82,15 +82,15 @@ module.exports = { - | esm export import specifier ./c ./node_modules/pmodule/b.js - Rspack x.x.x compiled successfully in X.XX + [inactive] from origin ./index.js + XX modules - + [inactive] harmony side effect evaluation ./b ./index.js + XX modules ./node_modules/pmodule/index.js XX:XX-XX - + [inactive] harmony export imported specifier ./b ./index.js + XX modules ./node_modules/pmodule/index.js XX:XX-XX - + [inactive] harmony export imported specifier ./b ./index.js + XX modules ./node_modules/pmodule/index.js XX:XX-XX - + [inactive] harmony export imported specifier ./b ./index.js + XX modules ./node_modules/pmodule/index.js XX:XX-XX + + [inactive] ESM side effect evaluation ./b ./index.js + XX modules ./node_modules/pmodule/index.js XX:XX-XX + + [inactive] ESM export imported specifier ./b ./index.js + XX modules ./node_modules/pmodule/index.js XX:XX-XX + + [inactive] ESM export imported specifier ./b ./index.js + XX modules ./node_modules/pmodule/index.js XX:XX-XX + + [inactive] ESM export imported specifier ./b ./index.js + XX modules ./node_modules/pmodule/index.js XX:XX-XX + [inactive] from origin ./node_modules/pmodule/index.js - + [inactive] harmony side effect evaluation ./b ./node_modules/pmodule/index.js XX:XX-XX - + [inactive] harmony export imported specifier ./b ./node_modules/pmodule/index.js XX:XX-XX - + [inactive] harmony export imported specifier ./b ./node_modules/pmodule/index.js XX:XX-XX - + [inactive] harmony export imported specifier ./b ./node_modules/pmodule/index.js XX:XX-XX + + [inactive] ESM side effect evaluation ./b ./node_modules/pmodule/index.js XX:XX-XX + + [inactive] ESM export imported specifier ./b ./node_modules/pmodule/index.js XX:XX-XX + + [inactive] ESM export imported specifier ./b ./node_modules/pmodule/index.js XX:XX-XX + + [inactive] ESM export imported specifier ./b ./node_modules/pmodule/index.js XX:XX-XX + webpack x.x.x compiled successfully in X ms" `); } diff --git a/tests/webpack-test/watchCases/parsing/caching-harmony/0/index.js b/tests/webpack-test/watchCases/parsing/caching-harmony/0/index.js index b03dc33d8b1..cf79ece1fc6 100644 --- a/tests/webpack-test/watchCases/parsing/caching-harmony/0/index.js +++ b/tests/webpack-test/watchCases/parsing/caching-harmony/0/index.js @@ -1,7 +1,7 @@ import m from "./module"; import cm from "./changing-module"; -it("should flag harmony modules correctly", function() { +it("should flag ES modules correctly", function() { expect(m).toBe("module" + WATCH_STEP); switch(WATCH_STEP) { case "0": diff --git a/website/docs/en/config/externals.mdx b/website/docs/en/config/externals.mdx index d746c0bc095..b0a3477714f 100644 --- a/website/docs/en/config/externals.mdx +++ b/website/docs/en/config/externals.mdx @@ -842,7 +842,7 @@ Treat references to `http(s)://...` and `std:...` as external and load them via Treat references to `http(s)://...` and `std:...` as external and load them via `async import()` when used **(Note that this external type is an `async` module, which has various effects on the execution)**. -Note that if you're going to output ES Modules with those node.js-related presets, Rspack will set the default `externalsType` to [`node-commonjs`](#externalstypenode-commonjs) which would use `createRequire` to construct a require function instead of using `require()`. +Note that if you're going to output ES modules with those node.js-related presets, Rspack will set the default `externalsType` to [`node-commonjs`](#externalstypenode-commonjs) which would use `createRequire` to construct a require function instead of using `require()`. **Example**