Commit 885eee80 authored by Nathaniel Hill's avatar Nathaniel Hill Committed by Tim Neutkens

Fix HMR when parent directory starts with '.' (#4589)

@timneutkens 

This simple change seems to work for me:

```
const ignored = [
    '**/.*',
    'node_modules'
]
```

I believe the regex is used here to try and work on windows as well. So, I wasted a bunch of time trying to figure out how to use a regex and/or the `path` module to ignore the parent directories until I noticed the following:

> glob patterns are not filepaths. They are a type of regular language that is converted to a JavaScript regular expression. Thus, when forward slashes are defined in a glob pattern, the resulting regular expression will match windows or POSIX path separators just fine.

this is from the [anymatch](https://github.com/micromatch/anymatch) documentation which is what webpack uses accoring to this:

https://webpack.js.org/configuration/watch/#watchoptions-ignored

I've verified this glob pattern solves the problem in my environment, can someone test and verify that this works on windows?

👍 
parent 64f3720e
...@@ -292,8 +292,10 @@ export default class HotReloader { ...@@ -292,8 +292,10 @@ export default class HotReloader {
this.prevChunkHashes = chunkHashes this.prevChunkHashes = chunkHashes
}) })
// We don’t watch .git .next/ and node_modules for changes
const ignored = [ const ignored = [
/(^|[/\\])\../, // .dotfiles /\.git/,
/\.next\//,
/node_modules/ /node_modules/
] ]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment