From 6b363f05a3f5f60a1072d250638ff3ec3a9d0284 Mon Sep 17 00:00:00 2001 From: Jonathan del Strother Date: Fri, 13 Aug 2021 15:59:36 +0100 Subject: [PATCH] Clarify limitations with mini-css-extract-plugin & initial chunks --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 80643224..5b7a88c1 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,23 @@ module.exports = { }; ``` +### ⚠ CSS is not loaded from initial chunks. + +Note that if you import CSS from your webpack entrypoint (in the initial chunk), `mini-css-extract-plugin` will not load this CSS into the page. `html-webpack-plugin` usually loads this CSS for you, but if you're not using that plugin, you'll need to use a dynamic `import()` to force the CSS to be split into a separate chunk. Either of the following would work: + +**component.js** + +```js +import("./style.css"); +``` + +**app.js** + +```js +import("./component"); +``` + + ## Options ### Plugin Options