Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Jun 14, 2021
1 parent 9a7cf9a commit e282a6c
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/configCases/entry/depend-on-non-js/a.css
@@ -0,0 +1 @@
module.exports = [[module.id, "body { background-color: green; }"]];
1 change: 1 addition & 0 deletions test/configCases/entry/depend-on-non-js/a.js
@@ -0,0 +1 @@
if (Math.random() < 0) require("./a.css");
1 change: 1 addition & 0 deletions test/configCases/entry/depend-on-non-js/b.css
@@ -0,0 +1 @@
module.exports = [[module.id, "body { color: red; }"]];
3 changes: 3 additions & 0 deletions test/configCases/entry/depend-on-non-js/b.js
@@ -0,0 +1,3 @@
if (Math.random() < 0) require("./b.css");

it("should run the test", () => {});
5 changes: 5 additions & 0 deletions test/configCases/entry/depend-on-non-js/test.config.js
@@ -0,0 +1,5 @@
module.exports = {
findBundle: function () {
return ["./runtime.js", "./a.js", "./b.js"];
}
};
38 changes: 38 additions & 0 deletions test/configCases/entry/depend-on-non-js/webpack.config.js
@@ -0,0 +1,38 @@
const MiniCssPlugin = require("mini-css-extract-plugin");

/** @type {import("../../../../").Configuration} */
module.exports = {
entry: {
a: "./a.js",
b: { import: "./b.js", dependOn: "a" }
},
module: {
rules: [
{
test: /\.css$/,
loader: MiniCssPlugin.loader
}
]
},
output: {
filename: "[name].js"
},
optimization: {
runtimeChunk: "single",
splitChunks: {
chunks: "all",
cacheGroups: {
styles: {
type: "css/mini-extract",
enforce: true
}
}
}
},
target: "web",
plugins: [
new MiniCssPlugin({
experimentalUseImportModule: true
})
]
};

0 comments on commit e282a6c

Please sign in to comment.