-
-
Notifications
You must be signed in to change notification settings - Fork 574
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: output should be consistent when using splitChunks (#8425)
- Loading branch information
Showing
13 changed files
with
12,455 additions
and
2 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
45 changes: 45 additions & 0 deletions
45
packages/rspack-test-tools/tests/compilerCases/consistent.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,45 @@ | ||
const stats = []; | ||
|
||
/** @type {import('../../dist').TCompilerCaseConfig} */ | ||
module.exports = { | ||
description: "should be called every compilation", | ||
options(context) { | ||
return { | ||
context: context.getSource(), | ||
entry: "./split-chunks/src/index.js", | ||
optimization: { | ||
splitChunks: { | ||
chunks: 'all', | ||
minSize: 100 * 1024, | ||
maxSize: 200 * 1024, | ||
} | ||
}, | ||
stats: { | ||
assets: true | ||
} | ||
}; | ||
}, | ||
async build(_, compiler) { | ||
await new Promise(resolve => { | ||
compiler.run((err, stat) => { | ||
if (err) { | ||
throw err | ||
} | ||
stats.push(stat.toJson().assets) | ||
compiler.run((_, stat) => { | ||
stats.push(stat.toJson().assets) | ||
compiler.run((_, stat) => { | ||
stats.push(stat.toJson().assets) | ||
resolve(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}, | ||
async check() { | ||
const stats1 = stats[0].reduce((acc, curr) => acc + curr.name, '') | ||
const stats2 = stats[1].reduce((acc, curr) => acc + curr.name, '') | ||
const stats3 = stats[2].reduce((acc, curr) => acc + curr.name, '') | ||
expect(stats1 === stats2 === stats3); | ||
} | ||
}; |
5,811 changes: 5,811 additions & 0 deletions
5,811
packages/rspack-test-tools/tests/fixtures/split-chunks/src/400k.js
Large diffs are not rendered by default.
Oops, something went wrong.
726 changes: 726 additions & 0 deletions
726
packages/rspack-test-tools/tests/fixtures/split-chunks/src/50k-1.js
Large diffs are not rendered by default.
Oops, something went wrong.
726 changes: 726 additions & 0 deletions
726
packages/rspack-test-tools/tests/fixtures/split-chunks/src/50k-2.js
Large diffs are not rendered by default.
Oops, something went wrong.
726 changes: 726 additions & 0 deletions
726
packages/rspack-test-tools/tests/fixtures/split-chunks/src/50k-3.js
Large diffs are not rendered by default.
Oops, something went wrong.
726 changes: 726 additions & 0 deletions
726
packages/rspack-test-tools/tests/fixtures/split-chunks/src/50k-4.js
Large diffs are not rendered by default.
Oops, something went wrong.
726 changes: 726 additions & 0 deletions
726
packages/rspack-test-tools/tests/fixtures/split-chunks/src/50k-5.js
Large diffs are not rendered by default.
Oops, something went wrong.
726 changes: 726 additions & 0 deletions
726
packages/rspack-test-tools/tests/fixtures/split-chunks/src/50k-6.js
Large diffs are not rendered by default.
Oops, something went wrong.
726 changes: 726 additions & 0 deletions
726
packages/rspack-test-tools/tests/fixtures/split-chunks/src/50k-7.js
Large diffs are not rendered by default.
Oops, something went wrong.
726 changes: 726 additions & 0 deletions
726
packages/rspack-test-tools/tests/fixtures/split-chunks/src/50k-8.js
Large diffs are not rendered by default.
Oops, something went wrong.
726 changes: 726 additions & 0 deletions
726
packages/rspack-test-tools/tests/fixtures/split-chunks/src/50k.js
Large diffs are not rendered by default.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
packages/rspack-test-tools/tests/fixtures/split-chunks/src/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,59 @@ | ||
import { createElement } from "react"; | ||
import { render } from "react-dom"; | ||
import { fiftyK } from "./50k"; | ||
import { fiftyK as fiftyK_1 } from "./50k-1"; | ||
import { fiftyK as fiftyK_2 } from "./50k-2"; | ||
import { fiftyK as fiftyK_3 } from "./50k-3"; | ||
import { fiftyK as fiftyK_4 } from "./50k-4"; | ||
import { fiftyK as fiftyK_5 } from "./50k-5"; | ||
import { fiftyK as fiftyK_6 } from "./50k-6"; | ||
import { fiftyK as fiftyK_7 } from "./50k-7"; | ||
import { fiftyK as fiftyK_8 } from "./50k-8"; | ||
|
||
import { | ||
fiftyK1, | ||
fiftyK2, | ||
fiftyK3, | ||
fiftyK4, | ||
fiftyK5, | ||
fiftyK6, | ||
fiftyK7, | ||
fiftyK8, | ||
} from "./400k"; | ||
|
||
import axios from "axios"; | ||
import dayjs from "dayjs"; | ||
import * as ReactUse from "react-use"; | ||
import * as ahooks from "ahooks"; | ||
|
||
window.lib = { | ||
axios, | ||
dayjs, | ||
ReactUse, | ||
ahooks, | ||
fiftyK, | ||
fiftyK1, | ||
fiftyK2, | ||
fiftyK3, | ||
fiftyK4, | ||
fiftyK5, | ||
fiftyK6, | ||
fiftyK7, | ||
fiftyK8, | ||
fiftyK_1, | ||
fiftyK_2, | ||
fiftyK_3, | ||
fiftyK_4, | ||
fiftyK_5, | ||
fiftyK_6, | ||
fiftyK_7, | ||
fiftyK_8, | ||
}; | ||
|
||
render( | ||
createElement("div", null, [ | ||
createElement("h1", null, `Hello World ${__BUNDLE__}`), | ||
createElement("p", null, "see more detail in devtool/network"), | ||
]), | ||
document.getElementById("root") | ||
); |
7c9e9f8
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
7c9e9f8
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