Gives an error while building app with ionic cordova build android --prod


#1

Error: ./src/app/main.ts
Module not found: Error: Can’t resolve ‘./app.module.ngfactory’ in 'E:\workstation\expo\ionic\bik\src\app’
resolve ‘./app.module.ngfactory’ in 'E:\workstation\expo\ionic\bik\src\app’
using description file: E:\workstation\expo\ionic\bik\package.json (relative path: ./src/app)
Field ‘browser’ doesn’t contain a valid alias configuration
after using description file: E:\workstation\expo\ionic\bik\package.json (relative path: ./src/app)
using description file: E:\workstation\expo\ionic\bik\package.json (relative path: ./src/app/app.module.ngfactory)
no extension
Field ‘browser’ doesn’t contain a valid alias configuration
E:\workstation\expo\ionic\bik\src\app\app.module.ngfactory doesn’t exist
.ts
Field ‘browser’ doesn’t contain a valid alias configuration
E:\workstation\expo\ionic\bik\src\app\app.module.ngfactory.ts doesn’t exist
.js
Field ‘browser’ doesn’t contain a valid alias configuration
E:\workstation\expo\ionic\bik\src\app\app.module.ngfactory.js doesn’t exist
.json
Field ‘browser’ doesn’t contain a valid alias configuration
E:\workstation\expo\ionic\bik\src\app\app.module.ngfactory.json doesn’t exist
as directory
E:\workstation\expo\ionic\bik\src\app\app.module.ngfactory doesn’t exist
[E:\workstation\expo\ionic\bik\src\app\app.module.ngfactory]
[E:\workstation\expo\ionic\bik\src\app\app.module.ngfactory.ts]
[E:\workstation\expo\ionic\bik\src\app\app.module.ngfactory.js]
[E:\workstation\expo\ionic\bik\src\app\app.module.ngfactory.json]
[E:\workstation\expo\ionic\bik\src\app\app.module.ngfactory]
@ ./src/app/main.ts 2:0-60
at BuildError.Error (native)
at new BuildError (E:\workstation\expo\ionic\bik\node_modules@ionic\app-scripts\dist\util\errors.js:16:28)
at callback (E:\workstation\expo\ionic\bik\node_modules@ionic\app-scripts\dist\webpack.js:121:28)
at emitRecords.err (E:\workstation\expo\ionic\bik\node_modules\webpack\lib\Compiler.js:269:13)
at Compiler.emitRecords (E:\workstation\expo\ionic\bik\node_modules\webpack\lib\Compiler.js:375:38)
at emitAssets.err (E:\workstation\expo\ionic\bik\node_modules\webpack\lib\Compiler.js:262:10)
at applyPluginsAsyncSeries1.err (E:\workstation\expo\ionic\bik\node_modules\webpack\lib\Compiler.js:368:12)
at next (E:\workstation\expo\ionic\bik\node_modules\tapable\lib\Tapable.js:218:11)
at Compiler.compiler.plugin (E:\workstation\expo\ionic\bik\node_modules\webpack\lib\performance\SizeLimitsPlugin.js:99:4)
at Compiler.applyPluginsAsyncSeries1 (E:\workstation\expo\ionic\bik\node_modules\tapable\lib\Tapable.js:222:13)

gives this error while building in prod mode

ionic cordova build android --prod

building with --release is working fine the app is working absolutely fine otherwise

ioni info is

cli packages: (C:\Users\lapi\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

@ionic/app-scripts : 3.1.0
Cordova Platforms  : android 6.3.0
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.0.2
Node              : v6.11.1
npm               : 3.10.10
OS                : Windows 10

Environment Variables:

ANDROID_HOME : C:\Users\lapi\AppData\Local\Android\android-sdk

Misc:

backend : legacy

please help


#2

See: