watchpack
watchpack copied to clipboard
fix: ignore the error that directoryPath is not a directory
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