Skip to content

Commit 4eac0f6

Browse files
docs(readme): Adding example of manual hotloader implementation
In the event users cannot get it to work, theres an example in the docs to reference
1 parent b25c2da commit 4eac0f6

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,30 @@ new ExtractCssChunk({
281281

282282
>Keep in mind, by default `[name].css` is used when `process.env.NODE_ENV === 'development'` and `[name].[contenthash].css` during production, so you can likely forget about having to pass anything.
283283
284+
### HMR Troubleshooting
285+
**Blank array in HMR script?**
286+
287+
If you have issues with HMR, but enabled the loader, plugin, and already tried `hot: true, reloadAll:true`, then your webpack config might be more abstract than my simple lookup functions. In this case, Ive exported out the actual hot loader, you can add this manually and as long as you've got the plugin and loader -- it'll work
288+
289+
```js
290+
rules: [
291+
{
292+
test: /\.css$/,
293+
use: [
294+
ExtractCssChunks.hotLoader, // for those who want to manually force hotLoading
295+
ExtractCssChunks.loader,
296+
{
297+
loader: 'css-loader',
298+
options: {
299+
modules: true,
300+
localIdentName: '[name]__[local]--[hash:base64:5]',
301+
},
302+
},
303+
],
304+
},
305+
]
306+
```
307+
284308
### HMR Pitfall
285309

286310
The most common workflow when working with webpack is to write a "development" / "production" value in to the

0 commit comments

Comments
 (0)