-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15196 from webpack/bugfix/lazy-compilation-hmr
fix HMR when experiments.lazyCompilation is enabled
- Loading branch information
Showing
7 changed files
with
102 additions
and
23 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
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 |
---|---|---|
|
@@ -3,3 +3,5 @@ export default 42; | |
export default 42; | ||
--- | ||
export default 43; | ||
--- | ||
export default 44; |
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,25 @@ | ||
import value from "./module"; | ||
|
||
const neverCalled = () => import("./lazy"); | ||
|
||
it("should compile to lazy imported module", done => { | ||
let generation = 0; | ||
module.hot.accept("./module", () => { | ||
generation++; | ||
}); | ||
expect(value).toBe(42); | ||
expect(generation).toBe(0); | ||
NEXT( | ||
require("../../update")(done, true, () => { | ||
expect(value).toBe(43); | ||
expect(generation).toBe(1); | ||
NEXT( | ||
require("../../update")(done, true, () => { | ||
expect(value).toBe(44); | ||
expect(generation).toBe(2); | ||
done(); | ||
}) | ||
); | ||
}) | ||
); | ||
}); |
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 default 123; |
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 @@ | ||
export default 42; | ||
--- | ||
export default 43; | ||
--- | ||
export default 44; |
10 changes: 10 additions & 0 deletions
10
test/hotCases/lazy-compilation/unrelated/webpack.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,10 @@ | ||
"use strict"; | ||
|
||
/** @type {import("../../../../").Configuration} */ | ||
module.exports = { | ||
experiments: { | ||
lazyCompilation: { | ||
entries: false | ||
} | ||
} | ||
}; |