5

I am getting an error while running ng build--prod. And I also tried to run npm install but I am getting the same error on that also.

ERROR in Module build failed: TypeError: Cannot read property 'replace' of undefined
    at normalizeBackSlashDirection (D:\angular\blog\node_modules\webpack\lib\RequestShortener.js:15:17)
    at new RequestShortener (D:\angular\blog\node_modules\webpack\lib\RequestShortener.js:25:15)
    at new Compiler (D:\angular\blog\node_modules\webpack\lib\Compiler.js:136:27)
    at Compiler.createChildCompiler (D:\angular\blog\node_modules\webpack\lib\Compiler.js:371:25)
    at Compilation.createChildCompiler (D:\angular\blog\node_modules\webpack\lib\Compilation.js:1851:24)
    at Object.pitch (D:\angular\blog\node_modules\mini-css-extract-plugin\dist\loader.js:70:43)
Dheeraj Rijhwani
  • 351
  • 5
  • 18
  • Similar problem can be found here: https://stackoverflow.com/questions/59489609/error-in-module-build-failed-from-node-modules-angular-devkit-build-angular/67251321#67251321 – ArturL Apr 25 '21 at 08:42

1 Answers1

0

I know this is late but since I ran into the same issue recently, I would leave my thoughts here which could be helpful to someone. This appears to be an issue in mini-css-extract-plugin. You could try removing that and using a css-loader followed by css to string loader to get rid of the error.

userx
  • 1,083
  • 5
  • 18
  • 36