Skip to content

Commit

Permalink
fix(incremental): build chunk graph not build new added entry (#9225)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahabhgk authored Feb 11, 2025
1 parent 5121e8b commit 2adb783
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crates/rspack_core/src/build_chunk_graph/incremental.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,16 @@ impl CodeSplitter {
self.chunk_caches.remove(&block);
}

if compilation.entries.len() > compilation.entrypoints.len() {
edges.extend(
compilation
.entries
.keys()
.filter(|entry| !compilation.entrypoints.contains_key(entry.as_str()))
.map(|entry| ChunkReCreation::Entry(entry.to_owned())),
);
}

for edge in edges {
edge.rebuild(self, compilation)?;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
it("should have correct entrypoints", function() {
expect(Object.keys(__STATS__.entrypoints)).toEqual(["bundle0"]);
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
it("should have correct entrypoints", function() {
expect(Object.keys(__STATS__.entrypoints)).toEqual(["bundle0", "bundle1"]);
})
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log.bind(console, 1);
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const path = require("path");
const fs = require("fs");
const rspack = require("@rspack/core");

let compiler;

/** @type {import("@rspack/core").Configuration} */
module.exports = {
entry: async () => {
const context = compiler.context;
const files = await fs.promises.readdir(context);
let entries = files.filter(f => f.startsWith("index"));
entries.sort();
return entries.reduce((acc, e, i) => {
acc[`bundle${i}`] = path.resolve(context, e);
return acc;
}, {});
},
output: {
filename: "[name].js"
},
plugins: [
function (c) {
compiler = c;
}
]
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
findBundle(i) {
return ["bundle0.js"];
}
};

2 comments on commit 2adb783

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented on 2adb783 Feb 11, 2025

Choose a reason for hiding this comment

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

📝 Ecosystem CI detail: Open

suite result
modernjs ❌ failure
rspress ✅ success
rslib ✅ success
rsbuild ❌ failure
rsdoctor ❌ failure
examples ✅ success
devserver ✅ success
nuxt ✅ success

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented on 2adb783 Feb 11, 2025

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 (2025-02-11 9d82335) Current Change
10000_big_production-mode_disable-minimize + exec 37.7 s ± 637 ms 38.9 s ± 1 s +3.26 %
10000_development-mode + exec 1.88 s ± 89 ms 1.85 s ± 7.5 ms -1.47 %
10000_development-mode_hmr + exec 685 ms ± 7.4 ms 684 ms ± 7.6 ms -0.11 %
10000_production-mode + exec 2.28 s ± 51 ms 2.29 s ± 47 ms +0.58 %
10000_production-mode_persistent-cold + exec 2.47 s ± 72 ms 2.47 s ± 281 ms +0.26 %
10000_production-mode_persistent-hot + exec 1.65 s ± 61 ms 1.65 s ± 60 ms -0.18 %
arco-pro_development-mode + exec 1.78 s ± 145 ms 1.77 s ± 102 ms -0.47 %
arco-pro_development-mode_hmr + exec 389 ms ± 2.1 ms 387 ms ± 0.84 ms -0.34 %
arco-pro_production-mode + exec 3.59 s ± 217 ms 3.65 s ± 229 ms +1.53 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.72 s ± 229 ms 3.75 s ± 55 ms +0.89 %
arco-pro_production-mode_persistent-cold + exec 3.85 s ± 164 ms 3.81 s ± 140 ms -1.14 %
arco-pro_production-mode_persistent-hot + exec 2.36 s ± 99 ms 2.39 s ± 101 ms +1.22 %
arco-pro_production-mode_traverse-chunk-modules + exec 3.63 s ± 69 ms 3.72 s ± 126 ms +2.42 %
large-dyn-imports_development-mode + exec 2.09 s ± 24 ms 2.13 s ± 46 ms +1.83 %
large-dyn-imports_production-mode + exec 2.15 s ± 71 ms 2.14 s ± 43 ms -0.72 %
threejs_development-mode_10x + exec 1.54 s ± 25 ms 1.53 s ± 18 ms -0.35 %
threejs_development-mode_10x_hmr + exec 779 ms ± 7 ms 789 ms ± 13 ms +1.30 %
threejs_production-mode_10x + exec 5.2 s ± 32 ms 5.28 s ± 351 ms +1.59 %
threejs_production-mode_10x_persistent-cold + exec 5.27 s ± 65 ms 5.35 s ± 367 ms +1.50 %
threejs_production-mode_10x_persistent-hot + exec 4.53 s ± 220 ms 4.54 s ± 361 ms +0.32 %
10000_big_production-mode_disable-minimize + rss memory 8706 MiB ± 32.4 MiB 8709 MiB ± 47.9 MiB +0.03 %
10000_development-mode + rss memory 649 MiB ± 12.6 MiB 647 MiB ± 24.4 MiB -0.27 %
10000_development-mode_hmr + rss memory 1344 MiB ± 112 MiB 1249 MiB ± 201 MiB -7.05 %
10000_production-mode + rss memory 621 MiB ± 21.8 MiB 633 MiB ± 28.5 MiB +1.94 %
10000_production-mode_persistent-cold + rss memory 746 MiB ± 24.7 MiB 740 MiB ± 11.8 MiB -0.87 %
10000_production-mode_persistent-hot + rss memory 717 MiB ± 23.3 MiB 721 MiB ± 11.2 MiB +0.60 %
arco-pro_development-mode + rss memory 569 MiB ± 17.5 MiB 548 MiB ± 26.1 MiB -3.73 %
arco-pro_development-mode_hmr + rss memory 643 MiB ± 49.1 MiB 654 MiB ± 94.9 MiB +1.78 %
arco-pro_production-mode + rss memory 714 MiB ± 28.8 MiB 714 MiB ± 46.5 MiB -0.04 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 732 MiB ± 22.4 MiB 724 MiB ± 32.7 MiB -1.13 %
arco-pro_production-mode_persistent-cold + rss memory 853 MiB ± 45.5 MiB 835 MiB ± 27.2 MiB -2.06 %
arco-pro_production-mode_persistent-hot + rss memory 708 MiB ± 27.8 MiB 707 MiB ± 39.5 MiB -0.07 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 727 MiB ± 48.2 MiB 706 MiB ± 27.3 MiB -2.92 %
large-dyn-imports_development-mode + rss memory 644 MiB ± 5.26 MiB 643 MiB ± 5.48 MiB -0.08 %
large-dyn-imports_production-mode + rss memory 526 MiB ± 7.84 MiB 529 MiB ± 8.36 MiB +0.45 %
threejs_development-mode_10x + rss memory 553 MiB ± 16.3 MiB 542 MiB ± 33.7 MiB -2.00 %
threejs_development-mode_10x_hmr + rss memory 1145 MiB ± 140 MiB 1146 MiB ± 60.8 MiB +0.17 %
threejs_production-mode_10x + rss memory 828 MiB ± 50.8 MiB 833 MiB ± 18.2 MiB +0.65 %
threejs_production-mode_10x_persistent-cold + rss memory 960 MiB ± 14.5 MiB 962 MiB ± 33.1 MiB +0.17 %
threejs_production-mode_10x_persistent-hot + rss memory 877 MiB ± 54.8 MiB 878 MiB ± 17.6 MiB +0.07 %

Please sign in to comment.