watchpack icon indicating copy to clipboard operation
watchpack copied to clipboard

fix: ignore the error that directoryPath is not a directory

Open liximomo opened this issue 1 year ago • 2 comments

The error is caused by a specific alias config of webpack, considering the following example:

// webpack.config.js
module.exports = {
  resolve: {
    alias:  {
       "@/foo": ["src/foo/index", "src/foo"] 
     }
  }
}

With the above config, we will get a DirectoryWatcher watching src/foo/index. If you happen to have a src/foo file on your filesystem, you will see the error:

Watchpack Error (initial scan): Error: ENOTDIR: not a directory, scandir '/Users/xx/demo/src/foo'

We could safely ignore the error of ENOTDIR in whatever cases.

Related Issues: https://github.com/nuxt/bridge/issues/226

liximomo avatar Dec 12 '22 14:12 liximomo