Skip to content

Commit

Permalink
fix(config): snapshot config {timestamp: true} and {hash: true}
Browse files Browse the repository at this point in the history
  • Loading branch information
SoonIter committed Apr 29, 2024
1 parent d84f9bf commit 14182bf
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions packages/rspack/src/config/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,26 @@ const applySnapshotDefaults = (
snapshot: SnapshotOptions,
{ production }: { production: boolean }
) => {
D(snapshot, "module", {});
assertNotNill(snapshot.module);
D(snapshot.module, "timestamp", true);
D(snapshot.module, "hash", production);
D(snapshot, "resolve", {});
assertNotNill(snapshot.resolve);
D(snapshot.resolve, "timestamp", true);
D(snapshot.resolve, "hash", production);
if (typeof snapshot.module === "object") {
D(snapshot.module, "timestamp", false);
D(snapshot.module, "hash", false);
} else {
F(snapshot, "module", () =>
production
? { timestamp: true, hash: true }
: { timestamp: true, hash: false }
);
}
if (typeof snapshot.resolve === "object") {
D(snapshot.resolve, "timestamp", false);
D(snapshot.resolve, "hash", false);
} else {
F(snapshot, "resolve", () =>
production
? { timestamp: true, hash: true }
: { timestamp: true, hash: false }
);
}
};

const applyJavascriptParserOptionsDefaults = (
Expand Down

0 comments on commit 14182bf

Please sign in to comment.