enhanced-resolve: AliasFieldPlugin.apply + lodash: resolving the wrong toString
When resolving "./toString" from lodash, data2 on AliasFieldPlugin.js is removing the ./ from "./toString" of lodash, causing fieldData to get the default function toString() of every object.
Resulting in:
var idxQuery = identifier.indexOf("?");
^
TypeError: identifier.indexOf is not a function
at Resolver.parse (/Users/fcconstantino/Projects/@products/@crefisa/NetBankApp/node_modules/enhanced-resolve/lib/Resolver.js:181:28)
at Resolver.<anonymous> (/Users/fcconstantino/Projects/@products/@crefisa/NetBankApp/node_modules/enhanced-resolve/lib/ParsePlugin.js:17:25)
at Resolver.applyPluginsAsyncSeriesBailResult1 (/Users/fcconstantino/Projects/@products/@crefisa/NetBankApp/node_modules/tapable/lib/Tapable.js:256:13)
at runNormal (/Users/fcconstantino/Projects/@products/@crefisa/NetBankApp/node_modules/enhanced-resolve/lib/Resolver.js:130:20)
at Resolver.doResolve (/Users/fcconstantino/Projects/@products/@crefisa/NetBankApp/node_modules/enhanced-resolve/lib/Resolver.js:116:3)
at Resolver.<anonymous> (/Users/fcconstantino/Projects/@products/@crefisa/NetBankApp/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:37:12)
at Resolver.applyPluginsAsyncSeriesBailResult1 (/Users/fcconstantino/Projects/@products/@crefisa/NetBankApp/node_modules/tapable/lib/Tapable.js:256:13)
at runNormal (/Users/fcconstantino/Projects/@products/@crefisa/NetBankApp/node_modules/enhanced-resolve/lib/Resolver.js:130:20)
at Resolver.doResolve (/Users/fcconstantino/Projects/@products/@crefisa/NetBankApp/node_modules/enhanced-resolve/lib/Resolver.js:116:3)
at Resolver.<anonymous> (/Users/fcconstantino/Projects/@products/@crefisa/NetBankApp/node_modules/enhanced-resolve/lib/AliasFieldPlugin.js:49:12)
Something I couldn’t find is: Who is calling the AliasFieldPlugin?
A simple and easy fix was to do something like this:
if (typeof data === 'function') {
return callback();
}
OBS: I’m also using Haul, which uses an older version of webpack, but still the latest version of enhanced-resolve
| Using | Version |
|---|---|
| npm | 5.4.2 |
| webpack | 2.7.0 |
| enhanced-resolve | 3.4.1 |
| lodash | 4.17.4 |
| haul | 1.0.0-beta.5 |
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 5
- Comments: 16 (6 by maintainers)
Send a PR.
The only workaround I found for this issue is adding:
to my
package.json. @evilebottnawi you can find the repo hereHas any progress been made?