Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
66 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import pure from './pure' | ||
|
||
export default () => { | ||
pure() | ||
} |
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 @@ | ||
function pure() { | ||
console.log('pureFn'); | ||
} | ||
|
||
export default pure |
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,7 @@ | ||
import common from "../common"; | ||
|
||
it("entry1 should compile and run", () => { | ||
common() | ||
console.log('entry1'); | ||
expect(true).toBe(true) | ||
}); |
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,7 @@ | ||
it("entry2 should compile and run", () => { | ||
import(/* webpackChunkName: "chunk-reason-webpackChunkName" */'../common').then(common => { | ||
common.default() | ||
console.log('entry2'); | ||
expect(true).toBe(true) | ||
}) | ||
}); |
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 '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,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) | ||
}) | ||
}); |
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 @@ | ||
const findOutputFiles = require("../../../helpers/findOutputFiles"); | ||
|
||
module.exports = { | ||
findBundle(_, options) { | ||
const files = findOutputFiles(options, new RegExp(`^entry`)); | ||
return files; | ||
} | ||
}; |
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,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" | ||
} | ||
} | ||
} | ||
} | ||
}; |