diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fef0989..c1b031f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [1.4.1](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v1.4.0...v1.4.1) (2021-04-07) + + +### Bug Fixes + +* ES5 compatibility ([43e081f](https://github.com/webpack-contrib/mini-css-extract-plugin/commit/43e081f3a2767f3c00a29349a71ad17eca9cc168)) + ## [1.4.0](https://github.com/webpack-contrib/mini-css-extract-plugin/compare/v1.3.9...v1.4.0) (2021-03-26) diff --git a/README.md b/README.md index b78ce12d..995114aa 100644 --- a/README.md +++ b/README.md @@ -768,6 +768,8 @@ module.exports = { }; ``` +Note that `type` should be used instead of `test` in Webpack 5, or else an extra `.js` file can be generated besides the `.css` file. This is because `test` doesn't know which modules should be dropped (in this case, it won't detect that `.js` should be dropped). + ### Extracting CSS based on entry You may also extract the CSS based on the webpack entry name. diff --git a/package-lock.json b/package-lock.json index c7b6138e..3b902153 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "mini-css-extract-plugin", - "version": "1.4.0", + "version": "1.4.1", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index 6b3e95bd..26abd63e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mini-css-extract-plugin", - "version": "1.4.0", + "version": "1.4.1", "description": "extracts CSS into separate files", "license": "MIT", "repository": "webpack-contrib/mini-css-extract-plugin", diff --git a/src/index.js b/src/index.js index 5ca6dbf7..c5483c46 100644 --- a/src/index.js +++ b/src/index.js @@ -1017,7 +1017,7 @@ class MiniCssExtractPlugin { [ `var href = ${RuntimeGlobals.require}.miniCssF(chunkId);`, `var fullhref = ${RuntimeGlobals.publicPath} + href;`, - 'const oldTag = findStylesheet(href, fullhref);', + 'var oldTag = findStylesheet(href, fullhref);', 'if(!oldTag) return;', `promises.push(new Promise(${runtimeTemplate.basicFunction( 'resolve, reject', diff --git a/test/cases/hmr/expected/webpack-5/main.js b/test/cases/hmr/expected/webpack-5/main.js index f3bb017d..ae52744f 100644 --- a/test/cases/hmr/expected/webpack-5/main.js +++ b/test/cases/hmr/expected/webpack-5/main.js @@ -914,7 +914,7 @@ module.exports = function (urlString) { /******/ chunkIds.forEach((chunkId) => { /******/ var href = __webpack_require__.miniCssF(chunkId); /******/ var fullhref = __webpack_require__.p + href; -/******/ const oldTag = findStylesheet(href, fullhref); +/******/ var oldTag = findStylesheet(href, fullhref); /******/ if(!oldTag) return; /******/ promises.push(new Promise((resolve, reject) => { /******/ var tag = createStylesheet(chunkId, fullhref, () => {