optimize-css-assets-webpack-plugin
optimize-css-assets-webpack-plugin copied to clipboard
process.env.NODE_PATH is undefined in webpack.config.prod.js
I just upgraded from optimize-css-assets-webpack-plugin 4.0.0 to 5.0.1 because of my z-index issue with cssnano.
However, in my webpack.config.prod.js file I get the following error when I call yarn build:
process.env.NODE_PATH.split(path.delimiter).filter(Boolean)
TypeError: Cannot read property 'split' of undefined
at Object.<anonymous> (C:\Users\winbuild\Development\myApp\config\webpack.config.prod.js:108:28)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\winbuild\Development\myApp\scripts\build.js:21:16)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Function.Module.runMain (module.js:609:10)
at startup (bootstrap_node.js:158:16)
error Command failed with exit code 1.
Somehow the process.env.NODE_PATH becomes undefined.
It works fine when I downgrade back to 4.0.0.
I got the same error, someone please.
yarn build yarn run v1.7.0 $ react-scripts build C:\codes\signage\node_modules\react-scripts\config\webpack.config.prod.js:222 process.env.NODE_PATH.split(path.delimiter).filter(Boolean) ^
TypeError: Cannot read property 'split' of undefined
at Object.<anonymous> (C:\codes\signage\node_modules\react-scripts\config\webpack.config.prod.js:222:29)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\codes\signage\node_modules\react-scripts\scripts\build.js:39:16)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Maybe related: https://github.com/jaredpalmer/razzle/issues/287 https://github.com/jaredpalmer/razzle/commit/b3916f04156f95dfaccde8754f16c6f49338e333