diff --git a/test/cases/split-chunks-no-vendor/expected/bundle.css b/test/cases/split-chunks-no-vendor/expected/bundle.css new file mode 100644 index 00000000..02961362 --- /dev/null +++ b/test/cases/split-chunks-no-vendor/expected/bundle.css @@ -0,0 +1,13 @@ +/* This could be bootstrap.css */ +body { + background: green; +} + +body { + background: red; +} + +.async { + color: red; +} + diff --git a/test/cases/split-chunks-no-vendor/index.js b/test/cases/split-chunks-no-vendor/index.js new file mode 100644 index 00000000..76095617 --- /dev/null +++ b/test/cases/split-chunks-no-vendor/index.js @@ -0,0 +1,8 @@ +// eslint-disable-next-line import/no-extraneous-dependencies +import "bootstrap/bootstrap.css"; +import "./style.css"; + +// eslint-disable-next-line import/first +import "package/index"; + +import("other-css/other.css"); diff --git a/test/cases/split-chunks-no-vendor/node_modules/bootstrap/bootstrap.css b/test/cases/split-chunks-no-vendor/node_modules/bootstrap/bootstrap.css new file mode 100644 index 00000000..223c4d00 --- /dev/null +++ b/test/cases/split-chunks-no-vendor/node_modules/bootstrap/bootstrap.css @@ -0,0 +1,4 @@ +/* This could be bootstrap.css */ +body { + background: green; +} diff --git a/test/cases/split-chunks-no-vendor/node_modules/other-css/other.css b/test/cases/split-chunks-no-vendor/node_modules/other-css/other.css new file mode 100644 index 00000000..b1645094 --- /dev/null +++ b/test/cases/split-chunks-no-vendor/node_modules/other-css/other.css @@ -0,0 +1,3 @@ +.async { + color: red; +} diff --git a/test/cases/split-chunks-no-vendor/node_modules/package/index.js b/test/cases/split-chunks-no-vendor/node_modules/package/index.js new file mode 100644 index 00000000..a2831caa --- /dev/null +++ b/test/cases/split-chunks-no-vendor/node_modules/package/index.js @@ -0,0 +1 @@ +console.log("HERE"); diff --git a/test/cases/split-chunks-no-vendor/style.css b/test/cases/split-chunks-no-vendor/style.css new file mode 100644 index 00000000..67ce83e4 --- /dev/null +++ b/test/cases/split-chunks-no-vendor/style.css @@ -0,0 +1,3 @@ +body { + background: red; +} diff --git a/test/cases/split-chunks-no-vendor/webpack.config.js b/test/cases/split-chunks-no-vendor/webpack.config.js new file mode 100644 index 00000000..b82b0ef0 --- /dev/null +++ b/test/cases/split-chunks-no-vendor/webpack.config.js @@ -0,0 +1,40 @@ +import Self from "../../../src"; + +module.exports = { + entry: "./index.js", + module: { + rules: [ + { + test: /\.css$/, + use: [Self.loader, "css-loader"], + }, + ], + }, + optimization: { + splitChunks: { + chunks: "all", + cacheGroups: { + default: false, + vendors: false, + vendor: { + test: /[\\/]node_modules[\\/]/, + name: "vendor", + chunks: "all", + enforce: true, + }, + styles: { + name: "bundle", + type: "css/mini-extract", + chunks: "all", + priority: 100, + enforce: true, + }, + }, + }, + }, + plugins: [ + new Self({ + filename: "[name].css", + }), + ], +};