From bb0d34c4b2f682d2908146de415c8cf6c6222fa6 Mon Sep 17 00:00:00 2001 From: nilptr Date: Tue, 14 Jan 2025 22:11:38 +0800 Subject: [PATCH 1/9] fix: align amd option behavior with webpack --- packages/rspack/src/config/adapter.ts | 54 ++++----- packages/rspack/src/config/normalization.ts | 119 ++++++++++---------- 2 files changed, 87 insertions(+), 86 deletions(-) diff --git a/packages/rspack/src/config/adapter.ts b/packages/rspack/src/config/adapter.ts index d62f23c663b5..2954292d72ff 100644 --- a/packages/rspack/src/config/adapter.ts +++ b/packages/rspack/src/config/adapter.ts @@ -96,7 +96,7 @@ export const getRawOptions = ( experiments, node: getRawNode(options.node), profile: options.profile!, - amd: options.amd, + amd: options.amd !== false ? JSON.stringify(options.amd || {}) : undefined, bail: options.bail!, __references: {} }; @@ -264,19 +264,19 @@ const getRawModuleRule = ( : undefined, descriptionData: rule.descriptionData ? Object.fromEntries( - Object.entries(rule.descriptionData).map(([k, v]) => [ - k, - getRawRuleSetCondition(v) - ]) - ) + Object.entries(rule.descriptionData).map(([k, v]) => [ + k, + getRawRuleSetCondition(v) + ]) + ) : undefined, with: rule.with ? Object.fromEntries( - Object.entries(rule.with).map(([k, v]) => [ - k, - getRawRuleSetCondition(v) - ]) - ) + Object.entries(rule.with).map(([k, v]) => [ + k, + getRawRuleSetCondition(v) + ]) + ) : undefined, resource: rule.resource ? getRawRuleSetCondition(rule.resource) : undefined, resourceQuery: rule.resourceQuery @@ -303,27 +303,27 @@ const getRawModuleRule = ( resolve: rule.resolve ? getRawResolve(rule.resolve) : undefined, oneOf: rule.oneOf ? rule.oneOf - .filter(Boolean) - .map((rule, index) => - getRawModuleRule( - rule as RuleSetRule, - `${path}.oneOf[${index}]`, - options, - (rule as RuleSetRule).type ?? upperType - ) + .filter(Boolean) + .map((rule, index) => + getRawModuleRule( + rule as RuleSetRule, + `${path}.oneOf[${index}]`, + options, + (rule as RuleSetRule).type ?? upperType ) + ) : undefined, rules: rule.rules ? rule.rules - .filter(Boolean) - .map((rule, index) => - getRawModuleRule( - rule as RuleSetRule, - `${path}.rules[${index}]`, - options, - (rule as RuleSetRule).type ?? upperType - ) + .filter(Boolean) + .map((rule, index) => + getRawModuleRule( + rule as RuleSetRule, + `${path}.rules[${index}]`, + options, + (rule as RuleSetRule).type ?? upperType ) + ) : undefined, enforce: rule.enforce }; diff --git a/packages/rspack/src/config/normalization.ts b/packages/rspack/src/config/normalization.ts index c9072f593cf9..54bfefdae526 100644 --- a/packages/rspack/src/config/normalization.ts +++ b/packages/rspack/src/config/normalization.ts @@ -12,6 +12,7 @@ import path from "node:path"; import util from "node:util"; import type { Compilation } from "../Compilation"; import type { + Amd, AssetModuleFilename, Bail, CacheOptions, @@ -94,13 +95,13 @@ export const getNormalizedRspackOptions = ( ignoreWarnings: config.ignoreWarnings !== undefined ? config.ignoreWarnings.map(ignore => { - if (typeof ignore === "function") { - return ignore; - } - return (warning: Error) => { - return ignore.test(warning.message); - }; - }) + if (typeof ignore === "function") { + return ignore; + } + return (warning: Error) => { + return ignore.test(warning.message); + }; + }) : undefined, name: config.name, dependencies: config.dependencies, @@ -111,14 +112,14 @@ export const getNormalizedRspackOptions = ( ? { main: {} } : typeof config.entry === "function" ? ( - fn => () => - Promise.resolve().then(fn).then(getNormalizedEntryStatic) - )(config.entry) + fn => () => + Promise.resolve().then(fn).then(getNormalizedEntryStatic) + )(config.entry) : getNormalizedEntryStatic(config.entry), output: nestedConfig(config.output, output => { if ("cssHeadDataCompression" in output) { util.deprecate( - () => {}, + () => { }, "cssHeadDataCompression is not used now, see https://github.com/web-infra-dev/rspack/pull/8534, this option could be removed in the future" )(); } @@ -127,14 +128,14 @@ export const getNormalizedRspackOptions = ( const libraryAsName = library; const libraryBase = typeof library === "object" && - library && - !Array.isArray(library) && - "type" in library + library && + !Array.isArray(library) && + "type" in library ? library : libraryAsName || output.libraryTarget ? ({ - name: libraryAsName - } as LibraryOptions) + name: libraryAsName + } as LibraryOptions) : undefined; return { path: output.path, @@ -349,22 +350,22 @@ export const getNormalizedRspackOptions = ( incremental: optionalNestedConfig(experiments.incremental, options => options === true ? ({ - make: true, - inferAsyncModules: true, - providedExports: true, - dependenciesDiagnostics: true, - sideEffects: true, - buildChunkGraph: true, - moduleIds: true, - chunkIds: true, - modulesHashes: true, - modulesCodegen: true, - modulesRuntimeRequirements: true, - chunksRuntimeRequirements: true, - chunksHashes: true, - chunksRender: true, - emitAssets: true - } satisfies Incremental) + make: true, + inferAsyncModules: true, + providedExports: true, + dependenciesDiagnostics: true, + sideEffects: true, + buildChunkGraph: true, + moduleIds: true, + chunkIds: true, + modulesHashes: true, + modulesCodegen: true, + modulesRuntimeRequirements: true, + chunksRuntimeRequirements: true, + chunksHashes: true, + chunksRender: true, + emitAssets: true + } satisfies Incremental) : options ) })), @@ -372,7 +373,7 @@ export const getNormalizedRspackOptions = ( watchOptions: cloneObject(config.watchOptions), devServer: config.devServer, profile: config.profile, - amd: config.amd ? JSON.stringify(config.amd) : undefined, + amd: config.amd, bail: config.bail }; }; @@ -475,14 +476,14 @@ const keyedNestedConfig = ( value === undefined ? {} : Object.keys(value).reduce( - (obj, key) => { - obj[key] = (customKeys && key in customKeys ? customKeys[key] : fn)( - value[key] - ); - return obj; - }, - {} as Record - ); + (obj, key) => { + obj[key] = (customKeys && key in customKeys ? customKeys[key] : fn)( + value[key] + ); + return obj; + }, + {} as Record + ); if (customKeys) { for (const key of Object.keys(customKeys)) { if (!(key in result)) { @@ -577,22 +578,22 @@ export interface ModuleOptionsNormalized { export type ExperimentCacheNormalized = | boolean | { - type: "memory"; - } + type: "memory"; + } | { - type: "persistent"; - buildDependencies: string[]; - version: string; - snapshot: { - immutablePaths: Array; - unmanagedPaths: Array; - managedPaths: Array; - }; - storage: { - type: "filesystem"; - directory: string; - }; - }; + type: "persistent"; + buildDependencies: string[]; + version: string; + snapshot: { + immutablePaths: Array; + unmanagedPaths: Array; + managedPaths: Array; + }; + storage: { + type: "filesystem"; + directory: string; + }; + }; export interface ExperimentsNormalized { cache?: ExperimentCacheNormalized; @@ -615,8 +616,8 @@ export type IgnoreWarningsNormalized = (( export type OptimizationRuntimeChunkNormalized = | false | { - name: string | ((entrypoint: { name: string }) => string); - }; + name: string | ((entrypoint: { name: string }) => string); + }; export interface RspackOptionsNormalized { name?: Name; @@ -648,6 +649,6 @@ export interface RspackOptionsNormalized { ignoreWarnings?: IgnoreWarningsNormalized; performance?: Performance; profile?: Profile; - amd?: string; + amd?: Amd; bail?: Bail; } From 82a862aeb2facbabadc06e0e55aa016ea5fb8622 Mon Sep 17 00:00:00 2001 From: nilptr Date: Tue, 14 Jan 2025 22:23:59 +0800 Subject: [PATCH 2/9] doc: add doc for amd option --- website/docs/en/config/other-options.mdx | 14 ++++++++++++++ website/docs/zh/config/other-options.mdx | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/website/docs/en/config/other-options.mdx b/website/docs/en/config/other-options.mdx index 42d3d7337975..a1fa93a5cc6a 100644 --- a/website/docs/en/config/other-options.mdx +++ b/website/docs/en/config/other-options.mdx @@ -7,6 +7,20 @@ import PropertyType from '@components/PropertyType'; These are the remaining configuration options supported by rspack. +## amd + + + +Set the value of `require.amd` or `define.amd`. Setting `amd` to false will disable Rspack's AMD support. + +```js title="rspack.config.js" +module.exports = { + amd: { + jQuery: true, + }, +}; +``` + ## bail diff --git a/website/docs/zh/config/other-options.mdx b/website/docs/zh/config/other-options.mdx index 27d24f54d94f..e1f4980b3b0f 100644 --- a/website/docs/zh/config/other-options.mdx +++ b/website/docs/zh/config/other-options.mdx @@ -7,6 +7,20 @@ import PropertyType from '@components/PropertyType'; 这里展示了 Rspack 支持的其余配置项。 +## amd + + + +设置 `require.amd` 或 `define.amd` 的值。设置 `amd` 为 `false` 会禁用 Rspack 的 AMD 支持。 + +```js title="rspack.config.js" +module.exports = { + amd: { + jQuery: true, + }, +}; +``` + ## bail From 7954d46d9072aa9b498da582bad860558459f7bf Mon Sep 17 00:00:00 2001 From: nilptr Date: Thu, 16 Jan 2025 22:21:40 +0800 Subject: [PATCH 3/9] fix: esm-commonjs-mix test case --- .../esm_detection_parser_plugin.rs | 27 ++++- packages/rspack/etc/core.api.md | 2 +- packages/rspack/src/config/adapter.ts | 52 ++++---- packages/rspack/src/config/normalization.ts | 114 +++++++++--------- 4 files changed, 109 insertions(+), 86 deletions(-) diff --git a/crates/rspack_plugin_javascript/src/parser_plugin/esm_detection_parser_plugin.rs b/crates/rspack_plugin_javascript/src/parser_plugin/esm_detection_parser_plugin.rs index de206af27917..2518c77c28cc 100644 --- a/crates/rspack_plugin_javascript/src/parser_plugin/esm_detection_parser_plugin.rs +++ b/crates/rspack_plugin_javascript/src/parser_plugin/esm_detection_parser_plugin.rs @@ -43,6 +43,11 @@ impl ESMDetectionParserPlugin { } } +// nonHarmonyIdentifiers +fn is_non_esm_identifier(name: &str) -> bool { + name == "exports" || name == "define" +} + // Port from https://github.com/webpack/webpack/blob/main/lib/dependencies/HarmonyDetectionParserPlugin.js impl JavascriptParserPlugin for ESMDetectionParserPlugin { fn program(&self, parser: &mut JavascriptParser, ast: &Program) -> Option { @@ -97,17 +102,35 @@ impl JavascriptParserPlugin for ESMDetectionParserPlugin { expr: &UnaryExpr, for_name: &str, ) -> Option { - (parser.is_esm && for_name == "exports") + (parser.is_esm && is_non_esm_identifier(for_name)) .then(|| BasicEvaluatedExpression::with_range(expr.span().real_lo(), expr.span_hi().0)) } + fn r#typeof( + &self, + parser: &mut JavascriptParser, + _expr: &UnaryExpr, + for_name: &str, + ) -> Option { + (parser.is_esm && is_non_esm_identifier(for_name)).then_some(true) + } + fn identifier( &self, parser: &mut JavascriptParser, _ident: &Ident, for_name: &str, ) -> Option { - (parser.is_esm && for_name == "exports").then_some(true) + (parser.is_esm && is_non_esm_identifier(for_name)).then_some(true) + } + + fn call( + &self, + parser: &mut JavascriptParser, + _expr: &swc_core::ecma::ast::CallExpr, + for_name: &str, + ) -> Option { + (parser.is_esm && is_non_esm_identifier(for_name)).then_some(true) } } diff --git a/packages/rspack/etc/core.api.md b/packages/rspack/etc/core.api.md index 452bc770c870..e3f013741cec 100644 --- a/packages/rspack/etc/core.api.md +++ b/packages/rspack/etc/core.api.md @@ -9575,7 +9575,7 @@ export { RspackOptionsApply as WebpackOptionsApply } // @public (undocumented) export interface RspackOptionsNormalized { // (undocumented) - amd?: string; + amd?: Amd; // (undocumented) bail?: Bail; // (undocumented) diff --git a/packages/rspack/src/config/adapter.ts b/packages/rspack/src/config/adapter.ts index 2954292d72ff..3a281887ebc5 100644 --- a/packages/rspack/src/config/adapter.ts +++ b/packages/rspack/src/config/adapter.ts @@ -264,19 +264,19 @@ const getRawModuleRule = ( : undefined, descriptionData: rule.descriptionData ? Object.fromEntries( - Object.entries(rule.descriptionData).map(([k, v]) => [ - k, - getRawRuleSetCondition(v) - ]) - ) + Object.entries(rule.descriptionData).map(([k, v]) => [ + k, + getRawRuleSetCondition(v) + ]) + ) : undefined, with: rule.with ? Object.fromEntries( - Object.entries(rule.with).map(([k, v]) => [ - k, - getRawRuleSetCondition(v) - ]) - ) + Object.entries(rule.with).map(([k, v]) => [ + k, + getRawRuleSetCondition(v) + ]) + ) : undefined, resource: rule.resource ? getRawRuleSetCondition(rule.resource) : undefined, resourceQuery: rule.resourceQuery @@ -303,27 +303,27 @@ const getRawModuleRule = ( resolve: rule.resolve ? getRawResolve(rule.resolve) : undefined, oneOf: rule.oneOf ? rule.oneOf - .filter(Boolean) - .map((rule, index) => - getRawModuleRule( - rule as RuleSetRule, - `${path}.oneOf[${index}]`, - options, - (rule as RuleSetRule).type ?? upperType + .filter(Boolean) + .map((rule, index) => + getRawModuleRule( + rule as RuleSetRule, + `${path}.oneOf[${index}]`, + options, + (rule as RuleSetRule).type ?? upperType + ) ) - ) : undefined, rules: rule.rules ? rule.rules - .filter(Boolean) - .map((rule, index) => - getRawModuleRule( - rule as RuleSetRule, - `${path}.rules[${index}]`, - options, - (rule as RuleSetRule).type ?? upperType + .filter(Boolean) + .map((rule, index) => + getRawModuleRule( + rule as RuleSetRule, + `${path}.rules[${index}]`, + options, + (rule as RuleSetRule).type ?? upperType + ) ) - ) : undefined, enforce: rule.enforce }; diff --git a/packages/rspack/src/config/normalization.ts b/packages/rspack/src/config/normalization.ts index 54bfefdae526..56a518b98f3d 100644 --- a/packages/rspack/src/config/normalization.ts +++ b/packages/rspack/src/config/normalization.ts @@ -95,13 +95,13 @@ export const getNormalizedRspackOptions = ( ignoreWarnings: config.ignoreWarnings !== undefined ? config.ignoreWarnings.map(ignore => { - if (typeof ignore === "function") { - return ignore; - } - return (warning: Error) => { - return ignore.test(warning.message); - }; - }) + if (typeof ignore === "function") { + return ignore; + } + return (warning: Error) => { + return ignore.test(warning.message); + }; + }) : undefined, name: config.name, dependencies: config.dependencies, @@ -112,14 +112,14 @@ export const getNormalizedRspackOptions = ( ? { main: {} } : typeof config.entry === "function" ? ( - fn => () => - Promise.resolve().then(fn).then(getNormalizedEntryStatic) - )(config.entry) + fn => () => + Promise.resolve().then(fn).then(getNormalizedEntryStatic) + )(config.entry) : getNormalizedEntryStatic(config.entry), output: nestedConfig(config.output, output => { if ("cssHeadDataCompression" in output) { util.deprecate( - () => { }, + () => {}, "cssHeadDataCompression is not used now, see https://github.com/web-infra-dev/rspack/pull/8534, this option could be removed in the future" )(); } @@ -128,14 +128,14 @@ export const getNormalizedRspackOptions = ( const libraryAsName = library; const libraryBase = typeof library === "object" && - library && - !Array.isArray(library) && - "type" in library + library && + !Array.isArray(library) && + "type" in library ? library : libraryAsName || output.libraryTarget ? ({ - name: libraryAsName - } as LibraryOptions) + name: libraryAsName + } as LibraryOptions) : undefined; return { path: output.path, @@ -350,22 +350,22 @@ export const getNormalizedRspackOptions = ( incremental: optionalNestedConfig(experiments.incremental, options => options === true ? ({ - make: true, - inferAsyncModules: true, - providedExports: true, - dependenciesDiagnostics: true, - sideEffects: true, - buildChunkGraph: true, - moduleIds: true, - chunkIds: true, - modulesHashes: true, - modulesCodegen: true, - modulesRuntimeRequirements: true, - chunksRuntimeRequirements: true, - chunksHashes: true, - chunksRender: true, - emitAssets: true - } satisfies Incremental) + make: true, + inferAsyncModules: true, + providedExports: true, + dependenciesDiagnostics: true, + sideEffects: true, + buildChunkGraph: true, + moduleIds: true, + chunkIds: true, + modulesHashes: true, + modulesCodegen: true, + modulesRuntimeRequirements: true, + chunksRuntimeRequirements: true, + chunksHashes: true, + chunksRender: true, + emitAssets: true + } satisfies Incremental) : options ) })), @@ -476,14 +476,14 @@ const keyedNestedConfig = ( value === undefined ? {} : Object.keys(value).reduce( - (obj, key) => { - obj[key] = (customKeys && key in customKeys ? customKeys[key] : fn)( - value[key] - ); - return obj; - }, - {} as Record - ); + (obj, key) => { + obj[key] = (customKeys && key in customKeys ? customKeys[key] : fn)( + value[key] + ); + return obj; + }, + {} as Record + ); if (customKeys) { for (const key of Object.keys(customKeys)) { if (!(key in result)) { @@ -578,22 +578,22 @@ export interface ModuleOptionsNormalized { export type ExperimentCacheNormalized = | boolean | { - type: "memory"; - } + type: "memory"; + } | { - type: "persistent"; - buildDependencies: string[]; - version: string; - snapshot: { - immutablePaths: Array; - unmanagedPaths: Array; - managedPaths: Array; - }; - storage: { - type: "filesystem"; - directory: string; - }; - }; + type: "persistent"; + buildDependencies: string[]; + version: string; + snapshot: { + immutablePaths: Array; + unmanagedPaths: Array; + managedPaths: Array; + }; + storage: { + type: "filesystem"; + directory: string; + }; + }; export interface ExperimentsNormalized { cache?: ExperimentCacheNormalized; @@ -616,8 +616,8 @@ export type IgnoreWarningsNormalized = (( export type OptimizationRuntimeChunkNormalized = | false | { - name: string | ((entrypoint: { name: string }) => string); - }; + name: string | ((entrypoint: { name: string }) => string); + }; export interface RspackOptionsNormalized { name?: Name; From 121c31094d0212540504187e361df6cde5e02946 Mon Sep 17 00:00:00 2001 From: nilptr Date: Thu, 16 Jan 2025 23:30:56 +0800 Subject: [PATCH 4/9] chore(APIPlugin): require.amd is supported now chore(normal/parsing/unsupport-require-property): require.amd should not be undefined now chore(normal/parsing/unsupport-require-property): require.version & require.onError to be discussed --- .../src/parser_plugin/api_plugin.rs | 1 - .../parsing/unsupport-require-property/index.js | 7 +++---- .../parsing/unsupport-require-property/warnings.js | 5 ++--- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/crates/rspack_plugin_javascript/src/parser_plugin/api_plugin.rs b/crates/rspack_plugin_javascript/src/parser_plugin/api_plugin.rs index 0412f57b7cf6..c35685759095 100644 --- a/crates/rspack_plugin_javascript/src/parser_plugin/api_plugin.rs +++ b/crates/rspack_plugin_javascript/src/parser_plugin/api_plugin.rs @@ -355,7 +355,6 @@ impl JavascriptParserPlugin for APIPlugin { not_supported_expr!(is_require_extensions, expr, "require.extensions"); not_supported_expr!(is_require_config, expr, "require.config"); not_supported_expr!(is_require_version, expr, "require.version"); - not_supported_expr!(is_require_amd, expr, "require.amd"); not_supported_expr!(is_require_include, expr, "require.include"); not_supported_expr!(is_require_onerror, expr, "require.onError"); not_supported_expr!(is_require_main_require, expr, "require.main.require"); diff --git a/packages/rspack-test-tools/tests/normalCases/parsing/unsupport-require-property/index.js b/packages/rspack-test-tools/tests/normalCases/parsing/unsupport-require-property/index.js index 5cf0c9fbbba7..8c67dbb4521e 100644 --- a/packages/rspack-test-tools/tests/normalCases/parsing/unsupport-require-property/index.js +++ b/packages/rspack-test-tools/tests/normalCases/parsing/unsupport-require-property/index.js @@ -1,15 +1,14 @@ it("should transform unsupported require api to undefined", function () { expect(require.extensions).toBeUndefined(); expect(require.config).toBeUndefined(); - expect(require.version).toBeUndefined(); - expect(require.amd).toBeUndefined(); + // expect(require.version).toBeUndefined(); expect(require.include).toBeUndefined(); - expect(require.onError).toBeUndefined(); + // expect(require.onError).toBeUndefined(); expect(require.main.require).toBeUndefined(); expect(module.parent.require).toBeUndefined(); expect(require.include("a")).toBeUndefined(); - expect(require.onError(function () {})).toBeUndefined(); + expect(require.onError(function () { })).toBeUndefined(); expect(require.main.require("a")).toBeUndefined(); expect(module.parent.require("a")).toBeUndefined(); diff --git a/packages/rspack-test-tools/tests/normalCases/parsing/unsupport-require-property/warnings.js b/packages/rspack-test-tools/tests/normalCases/parsing/unsupport-require-property/warnings.js index 486ffad8e8e9..8551c2b96e8d 100644 --- a/packages/rspack-test-tools/tests/normalCases/parsing/unsupport-require-property/warnings.js +++ b/packages/rspack-test-tools/tests/normalCases/parsing/unsupport-require-property/warnings.js @@ -1,10 +1,9 @@ module.exports = [ [/require.extensions is not supported by Rspack/], [/require.config is not supported by Rspack/], - [/require.version is not supported by Rspack/], - [/require.amd is not supported by Rspack/], + // [/require.version is not supported by Rspack/], [/require.include is not supported by Rspack/], - [/require.onError is not supported by Rspack/], + // [/require.onError is not supported by Rspack/], [/require.main.require is not supported by Rspack/], [/module.parent.require is not supported by Rspack/], [/require.include\(\) is not supported by Rspack/], From 37a736d904d07c99c11b9e78ac6d0846678e3231 Mon Sep 17 00:00:00 2001 From: nilptr Date: Thu, 16 Jan 2025 23:32:02 +0800 Subject: [PATCH 5/9] doc: update plugin support status table --- website/components/PluginSupportStatusTable.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/components/PluginSupportStatusTable.tsx b/website/components/PluginSupportStatusTable.tsx index aab985b55359..f321d9e64f84 100644 --- a/website/components/PluginSupportStatusTable.tsx +++ b/website/components/PluginSupportStatusTable.tsx @@ -204,7 +204,7 @@ const pluginSupportStatusList: PluginSupportStatus[] = [ }, { name: 'RequireJsStuffPlugin', - status: SupportStatus.NotSupported, + status: SupportStatus.FullySupported, }, { name: 'NodeSourcePlugin', @@ -217,7 +217,7 @@ const pluginSupportStatusList: PluginSupportStatus[] = [ }, { name: 'AMDPlugin', - status: SupportStatus.NotSupported, + status: SupportStatus.FullySupported, }, { name: 'CommonJsPlugin', From 4ec6bfcd381be4478e804ff0e84e0bc883f70af3 Mon Sep 17 00:00:00 2001 From: nilptr Date: Fri, 17 Jan 2025 22:54:17 +0800 Subject: [PATCH 6/9] fix(amd_require_dependency): generate correct code for require([deps]) chore: add more test cases for amd require --- .../src/dependency/amd/amd_require_dependency.rs | 2 +- .../tests/configCases/amd/require/dep.js | 3 +++ .../rspack-test-tools/tests/configCases/amd/require/fn.js | 2 ++ .../tests/configCases/amd/require/index.js | 8 ++++++++ 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 packages/rspack-test-tools/tests/configCases/amd/require/dep.js create mode 100644 packages/rspack-test-tools/tests/configCases/amd/require/fn.js diff --git a/crates/rspack_plugin_javascript/src/dependency/amd/amd_require_dependency.rs b/crates/rspack_plugin_javascript/src/dependency/amd/amd_require_dependency.rs index c2a224a8f4a8..1619e8ca131d 100644 --- a/crates/rspack_plugin_javascript/src/dependency/amd/amd_require_dependency.rs +++ b/crates/rspack_plugin_javascript/src/dependency/amd/amd_require_dependency.rs @@ -81,7 +81,7 @@ impl DependencyTemplate for AMDRequireDependency { { let start_block = promise + ".then(function() {"; let end_block = format!( - ";}})['catch']{}", + ";}})['catch']({})", RuntimeGlobals::UNCAUGHT_ERROR_HANDLER.name() ); code_generatable_context diff --git a/packages/rspack-test-tools/tests/configCases/amd/require/dep.js b/packages/rspack-test-tools/tests/configCases/amd/require/dep.js new file mode 100644 index 000000000000..2165571c84f2 --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/amd/require/dep.js @@ -0,0 +1,3 @@ +import fn from './fn'; + +fn(123); diff --git a/packages/rspack-test-tools/tests/configCases/amd/require/fn.js b/packages/rspack-test-tools/tests/configCases/amd/require/fn.js new file mode 100644 index 000000000000..74541a168e34 --- /dev/null +++ b/packages/rspack-test-tools/tests/configCases/amd/require/fn.js @@ -0,0 +1,2 @@ + +module.exports = jest.fn(); diff --git a/packages/rspack-test-tools/tests/configCases/amd/require/index.js b/packages/rspack-test-tools/tests/configCases/amd/require/index.js index 804ffa806326..a0110b1dfdcb 100644 --- a/packages/rspack-test-tools/tests/configCases/amd/require/index.js +++ b/packages/rspack-test-tools/tests/configCases/amd/require/index.js @@ -1,3 +1,11 @@ +it("require([...]) should work well", async function () { + const p = require(['./dep']); + expect(p).toBeInstanceOf(Promise); + + await p; + + expect(require('./fn')).toHaveBeenCalledWith(123); +}); it("require([...], function () {}) should work well", function (done) { require(['./add'], function (add) { From b61a6f14ed8ce19163e84ed0b4c55d466c9ecb26 Mon Sep 17 00:00:00 2001 From: nilptr Date: Fri, 17 Jan 2025 23:03:46 +0800 Subject: [PATCH 7/9] feat(getResolveDefaults): add amd to byDependency --- .../tests/configCases/amd/define-function/rspack.config.js | 7 ------- .../tests/configCases/amd/define-object/rspack.config.js | 7 ------- .../tests/configCases/amd/define-others/rspack.config.js | 7 ------- .../configCases/amd/define-with-deps/rspack.config.js | 7 ------- .../configCases/amd/define-with-name/rspack.config.js | 7 ------- .../tests/configCases/amd/define-wrapper/rspack.config.js | 7 ------- .../amd/require-error-callback/rspack.config.js | 7 ------- .../configCases/amd/require-local-module/rspack.config.js | 7 ------- .../configCases/amd/require-unsupported/rspack.config.js | 7 ------- .../tests/configCases/amd/require-wrapper/rspack.config.js | 7 ------- .../tests/configCases/amd/require/rspack.config.js | 7 ------- .../configCases/amd/requirejs-stuffs/rspack.config.js | 3 --- packages/rspack/src/config/defaults.ts | 2 +- 13 files changed, 1 insertion(+), 81 deletions(-) delete mode 100644 packages/rspack-test-tools/tests/configCases/amd/define-function/rspack.config.js delete mode 100644 packages/rspack-test-tools/tests/configCases/amd/define-object/rspack.config.js delete mode 100644 packages/rspack-test-tools/tests/configCases/amd/define-others/rspack.config.js delete mode 100644 packages/rspack-test-tools/tests/configCases/amd/define-with-deps/rspack.config.js delete mode 100644 packages/rspack-test-tools/tests/configCases/amd/define-with-name/rspack.config.js delete mode 100644 packages/rspack-test-tools/tests/configCases/amd/define-wrapper/rspack.config.js delete mode 100644 packages/rspack-test-tools/tests/configCases/amd/require-error-callback/rspack.config.js delete mode 100644 packages/rspack-test-tools/tests/configCases/amd/require-local-module/rspack.config.js delete mode 100644 packages/rspack-test-tools/tests/configCases/amd/require-unsupported/rspack.config.js delete mode 100644 packages/rspack-test-tools/tests/configCases/amd/require-wrapper/rspack.config.js delete mode 100644 packages/rspack-test-tools/tests/configCases/amd/require/rspack.config.js diff --git a/packages/rspack-test-tools/tests/configCases/amd/define-function/rspack.config.js b/packages/rspack-test-tools/tests/configCases/amd/define-function/rspack.config.js deleted file mode 100644 index dfb02e2ee7ee..000000000000 --- a/packages/rspack-test-tools/tests/configCases/amd/define-function/rspack.config.js +++ /dev/null @@ -1,7 +0,0 @@ -/** @type {import("@rspack/core").Configuration} */ -module.exports = { - resolve: { - extensions: ["...", ".js"], - }, - amd: { jQuery: true }, -}; diff --git a/packages/rspack-test-tools/tests/configCases/amd/define-object/rspack.config.js b/packages/rspack-test-tools/tests/configCases/amd/define-object/rspack.config.js deleted file mode 100644 index dfb02e2ee7ee..000000000000 --- a/packages/rspack-test-tools/tests/configCases/amd/define-object/rspack.config.js +++ /dev/null @@ -1,7 +0,0 @@ -/** @type {import("@rspack/core").Configuration} */ -module.exports = { - resolve: { - extensions: ["...", ".js"], - }, - amd: { jQuery: true }, -}; diff --git a/packages/rspack-test-tools/tests/configCases/amd/define-others/rspack.config.js b/packages/rspack-test-tools/tests/configCases/amd/define-others/rspack.config.js deleted file mode 100644 index dfb02e2ee7ee..000000000000 --- a/packages/rspack-test-tools/tests/configCases/amd/define-others/rspack.config.js +++ /dev/null @@ -1,7 +0,0 @@ -/** @type {import("@rspack/core").Configuration} */ -module.exports = { - resolve: { - extensions: ["...", ".js"], - }, - amd: { jQuery: true }, -}; diff --git a/packages/rspack-test-tools/tests/configCases/amd/define-with-deps/rspack.config.js b/packages/rspack-test-tools/tests/configCases/amd/define-with-deps/rspack.config.js deleted file mode 100644 index dfb02e2ee7ee..000000000000 --- a/packages/rspack-test-tools/tests/configCases/amd/define-with-deps/rspack.config.js +++ /dev/null @@ -1,7 +0,0 @@ -/** @type {import("@rspack/core").Configuration} */ -module.exports = { - resolve: { - extensions: ["...", ".js"], - }, - amd: { jQuery: true }, -}; diff --git a/packages/rspack-test-tools/tests/configCases/amd/define-with-name/rspack.config.js b/packages/rspack-test-tools/tests/configCases/amd/define-with-name/rspack.config.js deleted file mode 100644 index dfb02e2ee7ee..000000000000 --- a/packages/rspack-test-tools/tests/configCases/amd/define-with-name/rspack.config.js +++ /dev/null @@ -1,7 +0,0 @@ -/** @type {import("@rspack/core").Configuration} */ -module.exports = { - resolve: { - extensions: ["...", ".js"], - }, - amd: { jQuery: true }, -}; diff --git a/packages/rspack-test-tools/tests/configCases/amd/define-wrapper/rspack.config.js b/packages/rspack-test-tools/tests/configCases/amd/define-wrapper/rspack.config.js deleted file mode 100644 index dfb02e2ee7ee..000000000000 --- a/packages/rspack-test-tools/tests/configCases/amd/define-wrapper/rspack.config.js +++ /dev/null @@ -1,7 +0,0 @@ -/** @type {import("@rspack/core").Configuration} */ -module.exports = { - resolve: { - extensions: ["...", ".js"], - }, - amd: { jQuery: true }, -}; diff --git a/packages/rspack-test-tools/tests/configCases/amd/require-error-callback/rspack.config.js b/packages/rspack-test-tools/tests/configCases/amd/require-error-callback/rspack.config.js deleted file mode 100644 index dfb02e2ee7ee..000000000000 --- a/packages/rspack-test-tools/tests/configCases/amd/require-error-callback/rspack.config.js +++ /dev/null @@ -1,7 +0,0 @@ -/** @type {import("@rspack/core").Configuration} */ -module.exports = { - resolve: { - extensions: ["...", ".js"], - }, - amd: { jQuery: true }, -}; diff --git a/packages/rspack-test-tools/tests/configCases/amd/require-local-module/rspack.config.js b/packages/rspack-test-tools/tests/configCases/amd/require-local-module/rspack.config.js deleted file mode 100644 index dfb02e2ee7ee..000000000000 --- a/packages/rspack-test-tools/tests/configCases/amd/require-local-module/rspack.config.js +++ /dev/null @@ -1,7 +0,0 @@ -/** @type {import("@rspack/core").Configuration} */ -module.exports = { - resolve: { - extensions: ["...", ".js"], - }, - amd: { jQuery: true }, -}; diff --git a/packages/rspack-test-tools/tests/configCases/amd/require-unsupported/rspack.config.js b/packages/rspack-test-tools/tests/configCases/amd/require-unsupported/rspack.config.js deleted file mode 100644 index dfb02e2ee7ee..000000000000 --- a/packages/rspack-test-tools/tests/configCases/amd/require-unsupported/rspack.config.js +++ /dev/null @@ -1,7 +0,0 @@ -/** @type {import("@rspack/core").Configuration} */ -module.exports = { - resolve: { - extensions: ["...", ".js"], - }, - amd: { jQuery: true }, -}; diff --git a/packages/rspack-test-tools/tests/configCases/amd/require-wrapper/rspack.config.js b/packages/rspack-test-tools/tests/configCases/amd/require-wrapper/rspack.config.js deleted file mode 100644 index dfb02e2ee7ee..000000000000 --- a/packages/rspack-test-tools/tests/configCases/amd/require-wrapper/rspack.config.js +++ /dev/null @@ -1,7 +0,0 @@ -/** @type {import("@rspack/core").Configuration} */ -module.exports = { - resolve: { - extensions: ["...", ".js"], - }, - amd: { jQuery: true }, -}; diff --git a/packages/rspack-test-tools/tests/configCases/amd/require/rspack.config.js b/packages/rspack-test-tools/tests/configCases/amd/require/rspack.config.js deleted file mode 100644 index dfb02e2ee7ee..000000000000 --- a/packages/rspack-test-tools/tests/configCases/amd/require/rspack.config.js +++ /dev/null @@ -1,7 +0,0 @@ -/** @type {import("@rspack/core").Configuration} */ -module.exports = { - resolve: { - extensions: ["...", ".js"], - }, - amd: { jQuery: true }, -}; diff --git a/packages/rspack-test-tools/tests/configCases/amd/requirejs-stuffs/rspack.config.js b/packages/rspack-test-tools/tests/configCases/amd/requirejs-stuffs/rspack.config.js index dfb02e2ee7ee..33435f4fbce3 100644 --- a/packages/rspack-test-tools/tests/configCases/amd/requirejs-stuffs/rspack.config.js +++ b/packages/rspack-test-tools/tests/configCases/amd/requirejs-stuffs/rspack.config.js @@ -1,7 +1,4 @@ /** @type {import("@rspack/core").Configuration} */ module.exports = { - resolve: { - extensions: ["...", ".js"], - }, amd: { jQuery: true }, }; diff --git a/packages/rspack/src/config/defaults.ts b/packages/rspack/src/config/defaults.ts index e59bce649ee0..1b934f3c120d 100644 --- a/packages/rspack/src/config/defaults.ts +++ b/packages/rspack/src/config/defaults.ts @@ -1078,7 +1078,7 @@ const getResolveDefaults = ({ preferRelative: true }, commonjs: cjsDeps(), - // amd: cjsDeps(), + amd: cjsDeps(), // for backward-compat: loadModule // loader: cjsDeps(), // for backward-compat: Custom Dependency and getResolve without dependencyType From 3eff58c126d85b45dae1596535589c9113b36516 Mon Sep 17 00:00:00 2001 From: nilptr Date: Fri, 17 Jan 2025 23:08:21 +0800 Subject: [PATCH 8/9] chore: update defaults tests snapshots --- .../tests/__snapshots__/Defaults.test.js.snap | 20 +++++++++++++++++++ .../defaultsCases/target_/electron-main.js | 7 +++++++ .../defaultsCases/target_/electron-preload.js | 7 +++++++ .../tests/defaultsCases/target_/node.js | 7 +++++++ .../tests/defaultsCases/target_/nwjs.js | 7 +++++++ 5 files changed, 48 insertions(+) diff --git a/packages/rspack-test-tools/tests/__snapshots__/Defaults.test.js.snap b/packages/rspack-test-tools/tests/__snapshots__/Defaults.test.js.snap index cfbef2b9bd67..7de5979b1365 100644 --- a/packages/rspack-test-tools/tests/__snapshots__/Defaults.test.js.snap +++ b/packages/rspack-test-tools/tests/__snapshots__/Defaults.test.js.snap @@ -339,6 +339,26 @@ Object { resolve: Object { aliasFields: Array [], byDependency: Object { + amd: Object { + aliasFields: Array [ + browser, + ], + conditionNames: Array [ + require, + module, + ..., + ], + extensions: Array [ + .js, + .json, + .wasm, + ], + mainFields: Array [ + browser, + module, + ..., + ], + }, commonjs: Object { aliasFields: Array [ browser, diff --git a/packages/rspack-test-tools/tests/defaultsCases/target_/electron-main.js b/packages/rspack-test-tools/tests/defaultsCases/target_/electron-main.js index 2665253a10d3..88ee1449c375 100644 --- a/packages/rspack-test-tools/tests/defaultsCases/target_/electron-main.js +++ b/packages/rspack-test-tools/tests/defaultsCases/target_/electron-main.js @@ -98,6 +98,13 @@ module.exports = { @@ ... @@ - "browser", @@ ... @@ + - "aliasFields": Array [ + - "browser", + - ], + + "aliasFields": Array [], + @@ ... @@ + - "browser", + @@ ... @@ - "browser", + "node", + "electron", diff --git a/packages/rspack-test-tools/tests/defaultsCases/target_/electron-preload.js b/packages/rspack-test-tools/tests/defaultsCases/target_/electron-preload.js index d0bb76b16444..7064c3279144 100644 --- a/packages/rspack-test-tools/tests/defaultsCases/target_/electron-preload.js +++ b/packages/rspack-test-tools/tests/defaultsCases/target_/electron-preload.js @@ -96,6 +96,13 @@ module.exports = { @@ ... @@ - "browser", @@ ... @@ + - "aliasFields": Array [ + - "browser", + - ], + + "aliasFields": Array [], + @@ ... @@ + - "browser", + @@ ... @@ + "node", @@ ... @@ + "electron", diff --git a/packages/rspack-test-tools/tests/defaultsCases/target_/node.js b/packages/rspack-test-tools/tests/defaultsCases/target_/node.js index f8ae59445c29..984bd82e1860 100644 --- a/packages/rspack-test-tools/tests/defaultsCases/target_/node.js +++ b/packages/rspack-test-tools/tests/defaultsCases/target_/node.js @@ -93,6 +93,13 @@ module.exports = { @@ ... @@ - "browser", @@ ... @@ + - "aliasFields": Array [ + - "browser", + - ], + + "aliasFields": Array [], + @@ ... @@ + - "browser", + @@ ... @@ - "browser", + "node", @@ ... @@ diff --git a/packages/rspack-test-tools/tests/defaultsCases/target_/nwjs.js b/packages/rspack-test-tools/tests/defaultsCases/target_/nwjs.js index e1c9a9e01410..03adbd3bf58a 100644 --- a/packages/rspack-test-tools/tests/defaultsCases/target_/nwjs.js +++ b/packages/rspack-test-tools/tests/defaultsCases/target_/nwjs.js @@ -92,6 +92,13 @@ module.exports = { @@ ... @@ - "browser", @@ ... @@ + - "aliasFields": Array [ + - "browser", + - ], + + "aliasFields": Array [], + @@ ... @@ + - "browser", + @@ ... @@ + "node", @@ ... @@ + "nwjs", From 743166516b17942b64d3a98dd3aa27cc0f49e0b3 Mon Sep 17 00:00:00 2001 From: nilptr Date: Fri, 17 Jan 2025 23:11:48 +0800 Subject: [PATCH 9/9] chore: update webpack stats test cases snapshot --- .../StatsTestCases.basictest.js.snap | 100 ++++++------------ 1 file changed, 30 insertions(+), 70 deletions(-) diff --git a/tests/webpack-test/__snapshots__/StatsTestCases.basictest.js.snap b/tests/webpack-test/__snapshots__/StatsTestCases.basictest.js.snap index ec2e9d0a7d39..ed25aa3c98ae 100644 --- a/tests/webpack-test/__snapshots__/StatsTestCases.basictest.js.snap +++ b/tests/webpack-test/__snapshots__/StatsTestCases.basictest.js.snap @@ -576,101 +576,61 @@ Rspack x.x.x compiled successfully in X.23" exports[`StatsTestCases should print correct stats for limit-chunk-count-plugin 1`] = ` "1 chunks: - asset bundle1.js 4.06 KiB [emitted] (name: main) - chunk (runtime: main) bundle1.js (main) 357 bytes (javascript) 1.84 KiB (runtime) <{909}> >{909}< [entry] [rendered] + asset bundle1.js 3.87 KiB [emitted] (name: main) + chunk (runtime: main) bundle1.js (main) 219 bytes (javascript) 1.84 KiB (runtime) <{909}> >{909}< [entry] [rendered] ./a.js 22 bytes [dependent] [built] [code generated] + ./b.js 22 bytes [dependent] [built] [code generated] ./c.js 30 bytes [dependent] [built] [code generated] ./d.js 22 bytes [dependent] [built] [code generated] ./e.js 22 bytes [dependent] [built] [code generated] - ./index.js 101 bytes [built] [code generated] [1 warning] - Xdir/limit-chunk-count-plugin|sync 160 bytes [dependent] [built] [code generated] - - WARNING in ./index.js - ⚠ Critical dependency: the request of a dependency is an expression - ╭─[2:8] - 1 │ require.ensure([\\"./a\\"], function() {}); - 2 │ require([\\"./b\\"]); - · ──────── - 3 │ import(/* webpackChunkName: \\"c\\" */ \\"./c\\"); - ╰──── - - 1 chunks (Rspack x.x.x) compiled with 1 warning in X.23 + ./index.js 101 bytes [built] [code generated] + 1 chunks (Rspack x.x.x) compiled successfully in X.23 2 chunks: - asset bundle2.js 10.6 KiB [emitted] (name: main) - asset 76.bundle2.js 553 bytes [emitted] (name: c) - chunk (runtime: main) 76.bundle2.js (c) 96 bytes <{76}> <{909}> >{76}< [rendered] + asset bundle2.js 10.3 KiB [emitted] (name: main) + asset 76.bundle2.js 609 bytes [emitted] (name: c) + chunk (runtime: main) 76.bundle2.js (c) 118 bytes <{76}> <{909}> >{76}< [rendered] dependent modules 44 bytes [dependent] ./d.js 22 bytes [dependent] [built] [code generated] ./e.js 22 bytes [dependent] [built] [code generated] ./a.js 22 bytes [built] [code generated] + ./b.js 22 bytes [built] [code generated] ./c.js 30 bytes [built] [code generated] - chunk (runtime: main) bundle2.js (main) 261 bytes (javascript) 8.45 KiB (runtime) >{76}< [entry] [rendered] - ./index.js 101 bytes [built] [code generated] [1 warning] - Xdir/limit-chunk-count-plugin|sync 160 bytes [dependent] [built] [code generated] - - WARNING in ./index.js - ⚠ Critical dependency: the request of a dependency is an expression - ╭─[2:8] - 1 │ require.ensure([\\"./a\\"], function() {}); - 2 │ require([\\"./b\\"]); - · ──────── - 3 │ import(/* webpackChunkName: \\"c\\" */ \\"./c\\"); - ╰──── - - 2 chunks (Rspack x.x.x) compiled with 1 warning in X.23 + chunk (runtime: main) bundle2.js (main) 101 bytes (javascript) 8.45 KiB (runtime) >{76}< [entry] [rendered] + ./index.js 101 bytes [built] [code generated] + 2 chunks (Rspack x.x.x) compiled successfully in X.23 3 chunks: - asset bundle3.js 10.6 KiB [emitted] (name: main) + asset bundle3.js 10.3 KiB [emitted] (name: main) asset 76.bundle3.js 387 bytes [emitted] (name: c) - asset 588.bundle3.js 242 bytes [emitted] - chunk (runtime: main) 588.bundle3.js 66 bytes <{76}> <{909}> [rendered] + asset 656.bundle3.js 298 bytes [emitted] + chunk (runtime: main) 656.bundle3.js 88 bytes <{76}> <{909}> [rendered] ./a.js 22 bytes [built] [code generated] + ./b.js 22 bytes [built] [code generated] ./d.js 22 bytes [built] [code generated] ./e.js 22 bytes [built] [code generated] - chunk (runtime: main) 76.bundle3.js (c) 30 bytes <{909}> >{588}< [rendered] + chunk (runtime: main) 76.bundle3.js (c) 30 bytes <{909}> >{656}< [rendered] ./c.js 30 bytes [built] [code generated] - chunk (runtime: main) bundle3.js (main) 261 bytes (javascript) 8.45 KiB (runtime) >{588}< >{76}< [entry] [rendered] - ./index.js 101 bytes [built] [code generated] [1 warning] - Xdir/limit-chunk-count-plugin|sync 160 bytes [dependent] [built] [code generated] - - WARNING in ./index.js - ⚠ Critical dependency: the request of a dependency is an expression - ╭─[2:8] - 1 │ require.ensure([\\"./a\\"], function() {}); - 2 │ require([\\"./b\\"]); - · ──────── - 3 │ import(/* webpackChunkName: \\"c\\" */ \\"./c\\"); - ╰──── - - 3 chunks (Rspack x.x.x) compiled with 1 warning in X.23 + chunk (runtime: main) bundle3.js (main) 101 bytes (javascript) 8.45 KiB (runtime) >{656}< >{76}< [entry] [rendered] + ./index.js 101 bytes [built] [code generated] + 3 chunks (Rspack x.x.x) compiled successfully in X.23 4 chunks: - asset bundle4.js 10.6 KiB [emitted] (name: main) + asset bundle4.js 10.3 KiB [emitted] (name: main) asset 76.bundle4.js 387 bytes [emitted] (name: c) - asset 345.bundle4.js 186 bytes [emitted] - asset 272.bundle4.js 130 bytes [emitted] - chunk (runtime: main) 272.bundle4.js 22 bytes <{909}> [rendered] + asset 537.bundle4.js 242 bytes [emitted] + asset 697.bundle4.js 130 bytes [emitted] + chunk (runtime: main) 537.bundle4.js 66 bytes <{76}> <{909}> [rendered] ./a.js 22 bytes [built] [code generated] - chunk (runtime: main) 345.bundle4.js 44 bytes <{76}> [rendered] + ./b.js 22 bytes [built] [code generated] ./d.js 22 bytes [built] [code generated] + chunk (runtime: main) 697.bundle4.js 22 bytes <{76}> [rendered] ./e.js 22 bytes [built] [code generated] - chunk (runtime: main) 76.bundle4.js (c) 30 bytes <{909}> >{345}< [rendered] + chunk (runtime: main) 76.bundle4.js (c) 30 bytes <{909}> >{537}< >{697}< [rendered] ./c.js 30 bytes [built] [code generated] - chunk (runtime: main) bundle4.js (main) 261 bytes (javascript) 8.45 KiB (runtime) >{272}< >{76}< [entry] [rendered] - ./index.js 101 bytes [built] [code generated] [1 warning] - Xdir/limit-chunk-count-plugin|sync 160 bytes [dependent] [built] [code generated] - - WARNING in ./index.js - ⚠ Critical dependency: the request of a dependency is an expression - ╭─[2:8] - 1 │ require.ensure([\\"./a\\"], function() {}); - 2 │ require([\\"./b\\"]); - · ──────── - 3 │ import(/* webpackChunkName: \\"c\\" */ \\"./c\\"); - ╰──── - - 4 chunks (Rspack x.x.x) compiled with 1 warning in X.23" + chunk (runtime: main) bundle4.js (main) 101 bytes (javascript) 8.45 KiB (runtime) >{537}< >{76}< [entry] [rendered] + ./index.js 101 bytes [built] [code generated] + 4 chunks (Rspack x.x.x) compiled successfully in X.23" `; exports[`StatsTestCases should print correct stats for logging-debug 1`] = `