-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: chunk load failed with hashed id strategy (#805)
* fix: chunk load failed with hased id strategy * test: add hased case for code splitting * test: add hased case for css chunk hmr
- Loading branch information
1 parent
b245dac
commit 86e8b80
Showing
10 changed files
with
116 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
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const assert = require("assert"); | ||
const { testWithBrowser } = require("../../../scripts/test-utils"); | ||
|
||
const test = async () => { | ||
try { | ||
await testWithBrowser({ | ||
cwd: __dirname, | ||
fn: async ({ page }) => { | ||
const elm = await page.locator('#root'); | ||
const content = await elm.evaluate((el) => el.innerHTML); | ||
assert.equal(content, 'a utils', 'async chunk and common chunk should be loaded'); | ||
|
||
const styles = await elm.evaluate((el) => window.getComputedStyle(el)); | ||
assert.equal(styles.fontSize, '100px', 'async css chunk should be loaded'); | ||
}, | ||
entry: "index.js", | ||
}); | ||
} catch (e) { | ||
throw new Error(e); | ||
} | ||
}; | ||
module.exports = test; |
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 @@ | ||
{ | ||
"moduleIdStrategy": "hashed", | ||
"codeSplitting": { | ||
"minSize": 1, | ||
"groups": [ | ||
{ | ||
"name": "common", | ||
"test": "utils\\.ts", | ||
"minSize": 1 | ||
} | ||
] | ||
} | ||
} |
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 @@ | ||
import utils from './utils'; | ||
|
||
// @ts-ignore | ||
import('./b.css').then(() => { | ||
document.getElementById('root')!.innerHTML = `a ${utils}`; | ||
}); | ||
|
||
export default 'a'; |
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 @@ | ||
body { | ||
font-size: 100px; | ||
} |
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 @@ | ||
import('./a').then(console.log); |
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 'utils'; |
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