enhanced-resolve: Error when using webpack in watch mode
I have updated to the latest release of this library (3.4.0), and that caused the watch
script I’ve added to package.json
(actually it is just webpack -d -w
) to break. It breaks with this error message:
/Users/daniel.rotter/Development/massiveart/sulu-minimal/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:145
if(key.startsWith(what))
^
TypeError: Cannot read property 'startsWith' of undefined
at Storage.purge (/Users/daniel.rotter/Development/massiveart/sulu-minimal/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:145:10)
at Storage.purge (/Users/daniel.rotter/Development/massiveart/sulu-minimal/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:150:9)
at CachedInputFileSystem.purge (/Users/daniel.rotter/Development/massiveart/sulu-minimal/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:259:20)
at Watchpack.watcher.once (/Users/daniel.rotter/Development/massiveart/sulu-minimal/node_modules/webpack/lib/node/NodeWatchFileSystem.js:42:26)
at Object.onceWrapper (events.js:318:30)
at emitTwo (events.js:125:13)
at Watchpack.emit (events.js:213:7)
at Watchpack._onTimeout (/Users/daniel.rotter/Development/massiveart/sulu-minimal/node_modules/watchpack/lib/watchpack.js:142:7)
at ontimeout (timers.js:488:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:283:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ watch: `webpack -d -w`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
The initial build works, but this error occurs after I save a file being watched. Is there some compatability issue with this release?
If I downgrade to version 3.3.0 of this library the watch task is working again.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 46
- Comments: 29
Commits related to this issue
- avoid calling `exists` if `loaderOptions.babelrc` is not provided Calling `fs.statSync` results in `TypeError: path must be a string or Buffer`. Although this is handled by the try...catch block in ... — committed to yyx990803/babel-loader by yyx990803 7 years ago
- Upgrade dependencies to avoid issue webpack/enhanced-resolve#97 — committed to Lyrkan/encore-typescript-karma by niji-vlebiannic 7 years ago
Looks like we have an
undefined
key here, likely from commit 03ef8f2:In a rush so I had to edit it like below as a temporary workaround:
Hope this can be fixed soon.
Fixed in https://github.com/webpack/enhanced-resolve/releases/tag/v3.4.1
Downgrading worked for me. If you’re using Yarn, think about updating your
yarn.lock
file when you install 3.3.0 manually :