Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add test case to pr-16701 #18343

Merged
merged 1 commit into from Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions test/configCases/inner-graph/pr-18342/common/index.js
@@ -0,0 +1,5 @@
import pure from './pure'

export default () => {
pure()
}
5 changes: 5 additions & 0 deletions test/configCases/inner-graph/pr-18342/common/pure.js
@@ -0,0 +1,5 @@
function pure() {
console.log('pureFn');
}

export default pure
7 changes: 7 additions & 0 deletions test/configCases/inner-graph/pr-18342/entry1/index.js
@@ -0,0 +1,7 @@
import common from "../common";

it("entry1 should compile and run", () => {
common()
console.log('entry1');
expect(true).toBe(true)
});
7 changes: 7 additions & 0 deletions test/configCases/inner-graph/pr-18342/entry2/index.js
@@ -0,0 +1,7 @@
it("entry2 should compile and run", () => {
import(/* webpackChunkName: "chunk-reason-webpackChunkName" */'../common').then(common => {
common.default()
console.log('entry2');
expect(true).toBe(true)
})
});
1 change: 1 addition & 0 deletions test/configCases/inner-graph/pr-18342/entry3/a.js
@@ -0,0 +1 @@
export default 'a'
7 changes: 7 additions & 0 deletions test/configCases/inner-graph/pr-18342/entry3/index.js
@@ -0,0 +1,7 @@
it("entry3 should compile and run", () => {
import(/* webpackChunkName: "chunk-reason-webpackChunkName" */'./a.js').then(a => {
console.log(a.default);
console.log('entry3');
expect(true).toBe(true)
})
});
8 changes: 8 additions & 0 deletions test/configCases/inner-graph/pr-18342/test.config.js
@@ -0,0 +1,8 @@
const findOutputFiles = require("../../../helpers/findOutputFiles");

module.exports = {
findBundle(_, options) {
const files = findOutputFiles(options, new RegExp(`^entry`));
return files;
}
};
26 changes: 26 additions & 0 deletions test/configCases/inner-graph/pr-18342/webpack.config.js
@@ -0,0 +1,26 @@
module.exports = {
target: ["node"],
entry: {
entry1: ["./entry1/index.js"],
entry2: ["./entry2/index.js"],
entry3: ["./entry3/index.js"]
},
output: {
filename: "[name].js",
chunkFilename: "[name].chunk.js"
},
optimization: {
minimize: false,
runtimeChunk: true,
splitChunks: {
chunks: "initial",
cacheGroups: {
pureFn: {
test: /pure/,
enforce: true,
name: "chunk-reason-split-chunks"
}
}
}
}
};