2019-09-26 21:52:19 +08:00
|
|
|
var MCEP = require("mini-css-extract-plugin");
|
|
|
|
|
|
2020-04-20 13:36:55 +08:00
|
|
|
/** @type {import("../../../../").Configuration} */
|
2019-09-26 21:52:19 +08:00
|
|
|
module.exports = {
|
|
|
|
|
entry: {
|
|
|
|
|
a: "./a",
|
|
|
|
|
b: "./b",
|
2021-01-12 00:20:51 +08:00
|
|
|
c: "./c.css",
|
|
|
|
|
x: "./x" // also imports chunk but with different exports
|
2019-09-26 21:52:19 +08:00
|
|
|
},
|
|
|
|
|
output: {
|
|
|
|
|
filename: "[name].js"
|
|
|
|
|
},
|
|
|
|
|
module: {
|
|
|
|
|
rules: [
|
|
|
|
|
{
|
|
|
|
|
test: /\.css$/,
|
|
|
|
|
use: [MCEP.loader, "css-loader"]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
},
|
2021-01-12 00:20:51 +08:00
|
|
|
optimization: {
|
|
|
|
|
chunkIds: "named"
|
|
|
|
|
},
|
2019-09-26 21:52:19 +08:00
|
|
|
target: "web",
|
|
|
|
|
node: {
|
|
|
|
|
__dirname: false
|
|
|
|
|
},
|
2021-01-12 00:20:51 +08:00
|
|
|
plugins: [
|
|
|
|
|
new MCEP(),
|
|
|
|
|
compiler => {
|
|
|
|
|
compiler.hooks.done.tap("Test", stats => {
|
|
|
|
|
const chunkIds = stats
|
|
|
|
|
.toJson({ all: false, chunks: true, ids: true })
|
|
|
|
|
.chunks.map(c => c.id)
|
|
|
|
|
.sort();
|
|
|
|
|
expect(chunkIds).toEqual([
|
|
|
|
|
"a",
|
|
|
|
|
"b",
|
|
|
|
|
"c",
|
|
|
|
|
"chunk_js-_43b60",
|
|
|
|
|
"chunk_js-_43b61",
|
|
|
|
|
"chunk_js-_43b62",
|
|
|
|
|
"d_css",
|
|
|
|
|
"x"
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
]
|
2019-09-26 21:52:19 +08:00
|
|
|
};
|