diff --git a/package.json b/package.json index 3cce8c9a8..52c9fe822 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "test:watch": "cross-env NODE_ENV=test jest --watch", "test:coverage": "cross-env NODE_ENV=test jest --collectCoverageFrom=\"src/**/*.js\" --coverage", "test:manual": "webpack-dev-server test/manual/src/index.js --open --config test/manual/webpack.config.js", + "test:manualDisableAsync": "webpack-dev-server test/manualDisableAsyncOption/src/index.js --open --config test/manualDisableAsyncOption/webpack.config.js", "pretest": "npm run lint", "test": "cross-env NODE_ENV=test npm run test:coverage", "defaults": "webpack-defaults" diff --git a/test/manualDisableAsyncOption/index.html b/test/manualDisableAsyncOption/index.html new file mode 100644 index 000000000..6491a3408 --- /dev/null +++ b/test/manualDisableAsyncOption/index.html @@ -0,0 +1,15 @@ + + + + + + mini-css-extract-plugin testcase + + + + + + + + + diff --git a/test/manualDisableAsyncOption/src/a.css b/test/manualDisableAsyncOption/src/a.css new file mode 100644 index 000000000..8555ec167 --- /dev/null +++ b/test/manualDisableAsyncOption/src/a.css @@ -0,0 +1,7 @@ +.container { + background: blue; + color: red; + width: 100%; + height: 20px; + text-align: center; +} diff --git a/test/manualDisableAsyncOption/src/b.css b/test/manualDisableAsyncOption/src/b.css new file mode 100644 index 000000000..481b6e78d --- /dev/null +++ b/test/manualDisableAsyncOption/src/b.css @@ -0,0 +1,7 @@ +.container { + background: purple; + color: green; + width: 100%; + height: 20px; + text-align: center; +} diff --git a/test/manualDisableAsyncOption/src/index.js b/test/manualDisableAsyncOption/src/index.js new file mode 100644 index 000000000..cdeeaec1e --- /dev/null +++ b/test/manualDisableAsyncOption/src/index.js @@ -0,0 +1,14 @@ +/* eslint-env browser */ + +import './a.css'; +import './b.css'; + +const render = () => { + let div = document.createElement('div'); + div.setAttribute('class', 'container'); + const text = 'My background color should be blue, and my text should be red!'; + div.innerHTML = text; + document.body.appendChild(div); +}; + +render(); diff --git a/test/manualDisableAsyncOption/webpack.config.js b/test/manualDisableAsyncOption/webpack.config.js new file mode 100644 index 000000000..fa648be62 --- /dev/null +++ b/test/manualDisableAsyncOption/webpack.config.js @@ -0,0 +1,45 @@ +const Self = require('../../'); + +module.exports = { + mode: 'development', + output: { + chunkFilename: '[name].js', + publicPath: '/dist/', + crossOriginLoading: 'anonymous', + }, + optimization: { + splitChunks: { + cacheGroups: { + default: false, + a: { + name: 'a', + test: /a.css/, + chunks: 'all', + enforce: true, + }, + b: { + name: 'b', + test: /b.css/, + chunks: 'all', + enforce: true, + }, + }, + }, + }, + module: { + rules: [ + { + test: /\.css$/, + use: [Self.loader, 'css-loader'], + }, + ], + }, + plugins: [ + new Self({ + filename: '[name].css', + }), + ], + devServer: { + contentBase: __dirname, + }, +};