-
-
Notifications
You must be signed in to change notification settings - Fork 603
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: hotUpdate chunk should have correct runtime (#8273)
- Loading branch information
Showing
9 changed files
with
51 additions
and
1 deletion.
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
13 changes: 13 additions & 0 deletions
13
packages/rspack-test-tools/tests/hotCases/runtime/add-runtime/index.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 @@ | ||
let value = require("./module.js"); | ||
import {a} from "./lib/a.js"; | ||
|
||
it("should compile", (done) => { | ||
expect(value).toBe(1); | ||
expect(a).toBe(1); | ||
module.hot.accept("./module.js", () => { | ||
value = require("./module"); | ||
expect(value).toBe(2); | ||
done(); | ||
}); | ||
NEXT(require("../../update")(done)); | ||
}); |
1 change: 1 addition & 0 deletions
1
packages/rspack-test-tools/tests/hotCases/runtime/add-runtime/lib/a.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 @@ | ||
export const a = 1 |
1 change: 1 addition & 0 deletions
1
packages/rspack-test-tools/tests/hotCases/runtime/add-runtime/lib/b.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 @@ | ||
export const b = 1 |
3 changes: 3 additions & 0 deletions
3
packages/rspack-test-tools/tests/hotCases/runtime/add-runtime/lib/package.json
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,3 @@ | ||
{ | ||
"sideEffects": true | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/rspack-test-tools/tests/hotCases/runtime/add-runtime/module.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,4 @@ | ||
module.exports = 1; | ||
--- | ||
new Worker(new URL('./worker.js', import.meta.url)) | ||
module.exports = 2; |
17 changes: 17 additions & 0 deletions
17
packages/rspack-test-tools/tests/hotCases/runtime/add-runtime/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,17 @@ | ||
module.exports = { | ||
optimization: { | ||
usedExports: true, | ||
// make 'lib' chunk runtime to be worker + entry | ||
splitChunks: { | ||
minSize: 0, | ||
chunks: "all", | ||
cacheGroups: { | ||
lib: { | ||
test: /[/\\]lib[/\\](a|b|index).js$/, | ||
name: "lib", | ||
filename: "bundle-lib.js" | ||
} | ||
} | ||
} | ||
} | ||
}; |
5 changes: 5 additions & 0 deletions
5
packages/rspack-test-tools/tests/hotCases/runtime/add-runtime/test.filter.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 = function (config) { | ||
if (config.target !== "web") { | ||
return false; | ||
} | ||
}; |
2 changes: 2 additions & 0 deletions
2
packages/rspack-test-tools/tests/hotCases/runtime/add-runtime/worker.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,2 @@ | ||
import {b} from "./lib/b.js"; | ||
b; |
2020005
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.
📝 Ran ecosystem CI: Open
2020005
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