lodash / lodash-webpack-plugin

Smaller modular Lodash builds.
Other
1.19k stars 63 forks source link

Cannot read property 'has' of undefined #186

Open blueror0105 opened 2 years ago

blueror0105 commented 2 years ago

Hello. I hope you are doing well. When I configured lodash webpack plugin and build it in runtime, I got below error. ` ERROR in ./assets/js/theme/account.js Module build failed (from ./node_modules/babel-loader/lib/index.js): TypeError: D:\work\node\cornerstone\assets\js\theme\account.js: Cannot read property 'has' of undefined at resolvePath (D:\work\node\cornerstone\node_modules\babel-plugin-lodash\lib\importModule.js:22:24) at importModule (D:\work\node\cornerstone\node_modules\babel-plugin-lodash\lib\importModule.js:36:53) at memoized (D:\work\node\cornerstone\node_modules\lodash\memoize.js:62:23) at D:\work\node\cornerstone\node_modules\babel-plugin-lodash\lib\index.js:217:63 at arrayEach (D:\work\node\cornerstone\node_modules\lodash_arrayEach.js:15:9) at forEach (D:\work\node\cornerstone\node_modules\lodash\forEach.js:38:10) at D:\work\node\cornerstone\node_modules\babel-plugin-lodash\lib\index.js:193:30 at arrayEach (D:\work\node\cornerstone\node_modules\lodash_arrayEach.js:15:9) at forEach (D:\work\node\cornerstone\node_modules\lodash\forEach.js:38:10) at D:\work\node\cornerstone\node_modules\babel-plugin-lodash\lib\index.js:181:28

ERROR in ./assets/js/theme/cart.js Module build failed (from ./node_modules/babel-loader/lib/index.js): TypeError: D:\work\node\cornerstone\assets\js\theme\cart.js: Cannot read property 'has' of undefined at resolvePath (D:\work\node\cornerstone\node_modules\babel-plugin-lodash\lib\importModule.js:22:24) at importModule (D:\work\node\cornerstone\node_modules\babel-plugin-lodash\lib\importModule.js:36:53) at memoized (D:\work\node\cornerstone\node_modules\lodash\memoize.js:62:23) at D:\work\node\cornerstone\node_modules\babel-plugin-lodash\lib\index.js:203:62 at arrayEach (D:\work\node\cornerstone\node_modules\lodash_arrayEach.js:15:9) at forEach (D:\work\node\cornerstone\node_modules\lodash\forEach.js:38:10) at D:\work\node\cornerstone\node_modules\babel-plugin-lodash\lib\index.js:193:30 at arrayEach (D:\work\node\cornerstone\node_modules\lodash_arrayEach.js:15:9) at forEach (D:\work\node\cornerstone\node_modules\lodash\forEach.js:38:10) at D:\work\node\cornerstone\node_modules\babel-plugin-lodash\lib\index.js:181:28

ERROR in ./assets/js/theme/common/carousel/utils/activatePlayPauseButton.js Module build failed (from ./node_modules/babel-loader/lib/index.js): TypeError: D:\work\node\cornerstone\assets\js\theme\common\carousel\utils\activatePlayPauseButton.js: Cannot read property 'has' of undefined at resolvePath (D:\work\node\cornerstone\node_modules\babel-plugin-lodash\lib\importModule.js:22:24) at importModule (D:\work\node\cornerstone\node_modules\babel-plugin-lodash\lib\importModule.js:36:53) at memoized (D:\work\node\cornerstone\node_modules\lodash\memoize.js:62:23) at D:\work\node\cornerstone\node_modules\babel-plugin-lodash\lib\index.js:203:62 at arrayEach (D:\work\node\cornerstone\node_modules\lodash_arrayEach.js:15:9) at forEach (D:\work\node\cornerstone\node_modules\lodash\forEach.js:38:10) at D:\work\node\cornerstone\node_modules\babel-plugin-lodash\lib\index.js:193:30 at arrayEach (D:\work\node\cornerstone\node_modules\lodash_arrayEach.js:15:9) at forEach (D:\work\node\cornerstone\node_modules\lodash\forEach.js:38:10) at D:\work\node\cornerstone\node_modules\babel-plugin-lodash\lib\index.js:181:28 `

Also I confiugred lodash-webpack-plugin in my webpack.js as below as you recommend. new LodashModuleReplacementPlugin({ 'collections': true, 'paths': true }),

But I still get the same error. Can anyone help me to resolve it?

I am using node 14.17.01 and npm 6.14.13