Skip to content

Commit

Permalink
fix(config): snapshot.module accept { timestamp: true} (#6387)
Browse files Browse the repository at this point in the history
* fix(config): snapshot config

* fix

---------

Co-authored-by: ahabhgk <[email protected]>
  • Loading branch information
SoonIter and ahabhgk authored Apr 29, 2024
1 parent ded8419 commit 3b313bb
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default 1;
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const a = "a";
import(`./a/${a}.js`);
it("should work when snapshot.module or snapshot.resolve only set { timestamp: true }", () => {
expect(require("./a/a").default).toBe(1);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
cache: true,
snapshot: {
module: {
timestamp: true,
},
resolve: {
timestamp: true,
},
},
};
18 changes: 8 additions & 10 deletions packages/rspack/src/config/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,14 @@ const applySnapshotDefaults = (
snapshot: SnapshotOptions,
{ production }: { production: boolean }
) => {
F(snapshot, "module", () =>
production
? { timestamp: true, hash: true }
: { timestamp: true, hash: false }
);
F(snapshot, "resolve", () =>
production
? { timestamp: true, hash: true }
: { timestamp: true, hash: false }
);
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);
};

const applyJavascriptParserOptionsDefaults = (
Expand Down

2 comments on commit 3b313bb

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Ran ecosystem CI: Open

suite result
modernjs, self-hosted, Linux, ci ✅ success
_selftest, ubuntu-latest ✅ success
nx, ubuntu-latest ❌ failure
rspress, ubuntu-latest ✅ success
rsbuild, ubuntu-latest ✅ success
compat, ubuntu-latest ✅ success
examples, ubuntu-latest ✅ success

@rspack-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Benchmark detail: Open

Name Base (2024-04-29 ec3c0df) Current Change
10000_development-mode + exec 2.8 s ± 43 ms 2.78 s ± 37 ms -0.44 %
10000_development-mode_hmr + exec 690 ms ± 16 ms 694 ms ± 11 ms +0.55 %
10000_production-mode + exec 2.49 s ± 18 ms 2.58 s ± 38 ms +3.86 %
arco-pro_development-mode + exec 2.54 s ± 39 ms 2.5 s ± 60 ms -1.61 %
arco-pro_development-mode_hmr + exec 431 ms ± 2.6 ms 431 ms ± 3 ms -0.03 %
arco-pro_development-mode_hmr_intercept-plugin + exec 443 ms ± 2.5 ms 443 ms ± 5 ms +0.12 %
arco-pro_development-mode_intercept-plugin + exec 3.25 s ± 72 ms 3.23 s ± 71 ms -0.63 %
arco-pro_production-mode + exec 3.99 s ± 103 ms 3.98 s ± 145 ms -0.25 %
arco-pro_production-mode_intercept-plugin + exec 4.75 s ± 102 ms 4.71 s ± 98 ms -0.88 %
threejs_development-mode_10x + exec 2.08 s ± 23 ms 2.05 s ± 22 ms -1.13 %
threejs_development-mode_10x_hmr + exec 771 ms ± 32 ms 778 ms ± 30 ms +0.96 %
threejs_production-mode_10x + exec 5.26 s ± 54 ms 5.35 s ± 46 ms +1.66 %

Please sign in to comment.