From b230776c2cdd120df7fc60fd0d4ea43220cd0810 Mon Sep 17 00:00:00 2001 From: hardfist Date: Wed, 14 Aug 2024 11:33:38 +0800 Subject: [PATCH] docs: delete benchmark page (#7566) --- packages/rspack/src/config/defaults.ts | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/packages/rspack/src/config/defaults.ts b/packages/rspack/src/config/defaults.ts index 3de849980a37..918f0904bc92 100644 --- a/packages/rspack/src/config/defaults.ts +++ b/packages/rspack/src/config/defaults.ts @@ -46,6 +46,7 @@ import type { Optimization, Performance, ResolveOptions, + RspackFutureOptions, RuleSetRules, SnapshotOptions } from "./zod"; @@ -110,6 +111,11 @@ export const applyRspackOptionsDefaults = ( entry: options.entry, futureDefaults: options.experiments.futureDefaults! }); + // bundlerInfo is affected by outputDefaults so must be executed after outputDefaults + applybundlerInfoDefaults( + options.experiments.rspackFuture, + options.output.library + ); applyExternalsPresetsDefaults(options.externalsPresets, { targetProperties @@ -197,16 +203,24 @@ const applyExperimentsDefaults = (experiments: ExperimentsNormalized) => { // IGNORE(experiments.rspackFuture): Rspack specific configuration D(experiments, "rspackFuture", {}); - if (typeof experiments.rspackFuture === "object") { - D(experiments.rspackFuture, "bundlerInfo", {}); - if (typeof experiments.rspackFuture.bundlerInfo === "object") { + // rspackFuture.bundlerInfo default value is applied after applyDefaults +}; + +const applybundlerInfoDefaults = ( + rspackFuture?: RspackFutureOptions, + library?: Library +) => { + if (typeof rspackFuture === "object") { + // don't inject for library mode + D(rspackFuture, "bundlerInfo", library ? undefined : {}); + if (typeof rspackFuture.bundlerInfo === "object") { D( - experiments.rspackFuture.bundlerInfo, + rspackFuture.bundlerInfo, "version", require("../../package.json").version ); - D(experiments.rspackFuture.bundlerInfo, "bundler", "rspack"); - D(experiments.rspackFuture.bundlerInfo, "force", true); + D(rspackFuture.bundlerInfo, "bundler", "rspack"); + D(rspackFuture.bundlerInfo, "force", true); } } };