Filesystem Cache is throwing TypeError: Cannot read property 'length' of undefined from ResolverCachePlugin
See original GitHub issueBug report
What is the current behavior?
Attempting to get the cache working for webpack 5. I have it working on one of my local repos, but this one (a clone of a different website), is throwing an error:
Relevant config:
cache: {
type: 'filesystem',
buildDependencies: {
config: [ '/Users/xxx/public-web/config/webpack.config.js' ]
}
}
Throws this error:
(node:23491) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'length' of undefined
at getType (/Users/xxx/public-web/node_modules/enhanced-resolve/lib/util/path.js:41:12)
at Resolver.isPrivate (/Users/xxx/public-web/node_modules/enhanced-resolve/lib/Resolver.js:446:10)
at Resolver.parse (/Users/xxx/public-web/node_modules/enhanced-resolve/lib/Resolver.js:430:25)
at /Users/xxx/public-web/node_modules/enhanced-resolve/lib/ParsePlugin.js:33:29
at _next0 (eval at create (/Users/xxx/public-web/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:8:1)
at eval (eval at create (/Users/xxx/public-web/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:30:1)
at /Users/xxx/public-web/node_modules/webpack/lib/cache/ResolverCachePlugin.js:199:17
at Hook.eval [as callAsync] (eval at create (/Users/xxx/public-web/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:22:1)
at Resolver.doResolve (/Users/xxx/public-web/node_modules/enhanced-resolve/lib/Resolver.js:398:16)
at doRealResolve (/Users/xxx/public-web/node_modules/webpack/lib/cache/ResolverCachePlugin.js:138:13)
Setting the webpack config config: false
eliminates the error and the build runs normally.
If the current behavior is a bug, please provide the steps to reproduce.
I see directories being created under my working repo in the node_modules/.cache
folder, but not on my problem repo. A .cache
folder is created, but no webpack
or webpack/client-development
folders.
What is the expected behavior?
Cannot figure out why one repo is throwing this error and the other is not.
Other relevant information: webpack version: 5.0.0 Node.js version: 14.13.1 Operating System: MacOS Catalina 10.15.7 Additional tools:
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:65 (33 by maintainers)
@egs33 big thanks, found the problem
Yes, I found bug, two problems:
sass-loader
WIP on first
I even can tell you why there is an error with
node-sass
and no problems withsass
😄