Reputation:
I am able to build an ionic app. When I tried to build production version for iOS:
ionic cordova build ios --prod
It shows the below error:
Error: ./src/app/main.ts Module not found: Error: Can't resolve './app.module.ngfactory' in '/Users/karthikcp/Documents/IONIC/CIS/src/app' resolve './app.module.ngfactory' in '/Users/karthikcp/Documents/IONIC/CIS/src/app' using description file: /Users/karthikcp/Documents/IONIC/CIS/package.json (relative path: ./src/app) Field 'browser' doesn't contain a valid alias configuration after using description file: /Users/karthikcp/Documents/IONIC/CIS/package.json (relative path: ./src/app) using description file: /Users/karthikcp/Documents/IONIC/CIS/package.json (relative path: ./src/app/app.module.ngfactory) no extension Field 'browser' doesn't contain a valid alias configuration /Users/karthikcp/Documents/IONIC/CIS/src/app/app.module.ngfactory doesn't exist .ts Field 'browser' doesn't contain a valid alias configuration /Users/karthikcp/Documents/IONIC/CIS/src/app/app.module.ngfactory.ts doesn't exist .js Field 'browser' doesn't contain a valid alias configuration /Users/karthikcp/Documents/IONIC/CIS/src/app/app.module.ngfactory.js doesn't exist .json Field 'browser' doesn't contain a valid alias configuration /Users/karthikcp/Documents/IONIC/CIS/src/app/app.module.ngfactory.json doesn't exist as directory /Users/karthikcp/Documents/IONIC/CIS/src/app/app.module.ngfactory doesn't exist [/Users/karthikcp/Documents/IONIC/CIS/src/app/app.module.ngfactory] [/Users/karthikcp/Documents/IONIC/CIS/src/app/app.module.ngfactory.ts] [/Users/karthikcp/Documents/IONIC/CIS/src/app/app.module.ngfactory.js] [/Users/karthikcp/Documents/IONIC/CIS/src/app/app.module.ngfactory.json] [/Users/karthikcp/Documents/IONIC/CIS/src/app/app.module.ngfactory] @ ./src/app/main.ts 2:0-60 at BuildError.Error (native) at new BuildError (/Users/karthikcp/Documents/IONIC/CIS/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28) at callback (/Users/karthikcp/Documents/IONIC/CIS/node_modules/@ionic/app-scripts/dist/webpack.js:121:28) at emitRecords.err (/Users/karthikcp/Documents/IONIC/CIS/node_modules/webpack/lib/Compiler.js:265:13) at Compiler.emitRecords (/Users/karthikcp/Documents/IONIC/CIS/node_modules/webpack/lib/Compiler.js:371:38) at emitAssets.err (/Users/karthikcp/Documents/IONIC/CIS/node_modules/webpack/lib/Compiler.js:258:10) at applyPluginsAsyncSeries1.err (/Users/karthikcp/Documents/IONIC/CIS/node_modules/webpack/lib/Compiler.js:364:12) at next (/Users/karthikcp/Documents/IONIC/CIS/node_modules/tapable/lib/Tapable.js:218:11) at Compiler.compiler.plugin (/Users/karthikcp/Documents/IONIC/CIS/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4) at Compiler.applyPluginsAsyncSeries1 (/Users/karthikcp/Documents/IONIC/CIS/node_modules/tapable/lib/Tapable.js:222:13)
I am using the latest Ionic version When not using --prod
then i am able to build it.. Please help me.. I am new to IONIC
Upvotes: 1
Views: 203
Reputation:
I solved this by deleting node_modules,package-lock.json
. Updated the package.json with:
"devDependencies": {
"@ionic/app-scripts": "nightly",
"typescript": "2.4.2"
},
and re-run
npm install
Upvotes: 1