-
-
Notifications
You must be signed in to change notification settings - Fork 632
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove dynamic entry should re-build chunk graph (#9425)
- Loading branch information
Showing
7 changed files
with
105 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/rspack-test-tools/tests/watchCases/entries/dynamic-entries-remove/0/index0.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
it("should have correct entrypoints", function() { | ||
expect(Object.keys(__STATS__.entrypoints)).toEqual(["bundle0", "bundle1"]); | ||
|
||
const index0 = __STATS__.modules.find(m => m.name === "./index0.js"); | ||
expect(index0.built).toBe(true); | ||
expect(index0.reasons.length).toBe(1); | ||
expect(index0.reasons[0].type).toBe("entry"); | ||
|
||
const index1 = __STATS__.modules.find(m => m.name === "./index1.js"); | ||
expect(index1.built).toBe(true); | ||
expect(index1.reasons.length).toBe(1); | ||
expect(index1.reasons[0].type).toBe("entry"); | ||
}) |
1 change: 1 addition & 0 deletions
1
packages/rspack-test-tools/tests/watchCases/entries/dynamic-entries-remove/0/index1.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log.bind(console, 1); |
8 changes: 8 additions & 0 deletions
8
packages/rspack-test-tools/tests/watchCases/entries/dynamic-entries-remove/1/index0.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
it("should have correct entrypoints", function() { | ||
expect(Object.keys(__STATS__.entrypoints)).toEqual(["bundle0"]); | ||
|
||
const index0 = __STATS__.modules.find(m => m.name === "./index0.js"); | ||
expect(index0.built).toBe(true); | ||
expect(index0.reasons.length).toBe(1); | ||
expect(index0.reasons[0].type).toBe("entry"); | ||
}) |
37 changes: 37 additions & 0 deletions
37
packages/rspack-test-tools/tests/watchCases/entries/dynamic-entries-remove/rspack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const path = require("path"); | ||
const fs = require("fs"); | ||
|
||
let compiler; | ||
let step = 0; | ||
let entries; | ||
|
||
/** @type {import("@rspack/core").Configuration} */ | ||
module.exports = { | ||
entry: async () => { | ||
const context = compiler.context; | ||
if (step === 0) { | ||
const files = await fs.promises.readdir(context); | ||
entries = files.filter(f => f.startsWith("index")); | ||
entries.sort(); | ||
} else if (step === 1) { | ||
entries.pop(); | ||
} else { | ||
throw new Error(`unreachable step: ${step}`); | ||
} | ||
return entries.reduce((acc, e, i) => { | ||
acc[`bundle${i}`] = path.resolve(context, e); | ||
return acc; | ||
}, {}); | ||
}, | ||
output: { | ||
filename: "[name].js" | ||
}, | ||
plugins: [ | ||
function (c) { | ||
compiler = c; | ||
c.hooks.done.tap("test", () => { | ||
step += 1; | ||
}); | ||
} | ||
] | ||
}; |
5 changes: 5 additions & 0 deletions
5
packages/rspack-test-tools/tests/watchCases/entries/dynamic-entries-remove/test.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
findBundle(i) { | ||
return ["bundle0.js"]; | ||
} | ||
}; |
5577719
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Ecosystem CI detail: Open
5577719
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Benchmark detail: Open
Threshold exceeded: ["10000_production-mode_persistent-hot + exec","arco-pro_production-mode_persistent-hot + exec"]