Production release build ionic 4 throws error unkown identifier

my app works when building dev and also works when running in ionic lab. Now i want to build for production and it fails with this error

ERROR in : Error: Internal error: unknown identifier [{"filePath":"/codebase/deliver-app/node_modules/@angular/router/router.d.ts","name":"RouteReuseStrategy","members":[]}]
at Object.importExpr$$1 [as importExpr] (/codebase/deliver-app/node_modules/@angular/compiler/bundles/compiler.umd.js:24170:27)
at tokenExpr (/codebase/deliver-app/node_modules/@angular/compiler/bundles/compiler.umd.js:19863:43)
at providerDef (/codebase/deliver-app/node_modules/@angular/compiler/bundles/compiler.umd.js:19789:24)
at /codebase/deliver-app/node_modules/@angular/compiler/bundles/compiler.umd.js:19959:81
at Array.map (<anonymous>)
at NgModuleCompiler.compile (/codebase/deliver-app/node_modules/@angular/compiler/bundles/compiler.umd.js:19959:48)
at AotCompiler._compileModule (/codebase/deliver-app/node_modules/@angular/compiler/bundles/compiler.umd.js:24115:36)
at /codebase/deliver-app/node_modules/@angular/compiler/bundles/compiler.umd.js:24034:70
at Array.forEach (<anonymous>)
at AotCompiler._compileImplFile (/codebase/deliver-app/node_modules/@angular/compiler/bundles/compiler.umd.js:24034:23)
at /codebase/deliver-app/node_modules/@angular/compiler/bundles/compiler.umd.js:24024:74
at Array.map (<anonymous>)
at AotCompiler.emitAllImpls (/codebase/deliver-app/node_modules/@angular/compiler/bundles/compiler.umd.js:24024:39)
at AngularCompilerProgram.generateFilesForEmit (/codebase/deliver-app/node_modules/@angular/compiler-cli/src/transformers/program.js:620:46)
at AngularCompilerProgram._emitRender2 (/codebase/deliver-app/node_modules/@angular/compiler-cli/src/transformers/program.js:266:47)
at AngularCompilerProgram.emit (/codebase/deliver-app/node_modules/@angular/compiler-cli/src/transformers/program.js:201:22)
at AngularCompilerPlugin._emit (/codebase/deliver-app/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:879:49)
at AngularCompilerPlugin._update (/codebase/deliver-app/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:676:50)
at process._tickCallback (internal/process/next_tick.js:68:7)
[ERROR] An error occurred while running subprocess ng.

I have no clue why this is happening. What can i do to fix this?

it happens when i run:

ionic cordova build android --prod --release