Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

src/zone-flags.ts is missing from the TypeScript compilation after upgrading to Ionic 5

I upgraded my Ionic 4 application by these two commands:

# Upgrading to Ionic 5
npm install @ionic/angular@latest @ionic/angular-toolkit@latest --save

# Upgrading to Angular 9
ng update @angular/core @angular/cli

And when I did ionic serve, I started getting this error:

> ng run app:serve --host=localhost --port=8100
[ng] chunk {} 0.js, 0.js.map () 22.1 kB  [rendered]
[ng] chunk {common} common.js, common.js.map (common) 25.7 kB  [rendered]
[ng] 
[ng] ERROR in ./src/zone-flags.ts
[ng] Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
[ng] Error: /Users/shashank/Projects/my-app/mobile-app/src/zone-flags.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
[ng]     at AngularCompilerPlugin.getCompiledFile (/Users/shashank/Projects/my-app/mobile-app/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:909:23)
[ng]     at plugin.done.then (/Users/shashank/Projects/my-app/mobile-app/node_modules/@ngtools/webpack/src/loader.js:41:31)
[ng]     at process._tickCallback (internal/process/next_tick.js:68:7)
like image 899
Shashank Agrawal Avatar asked Feb 12 '20 05:02

Shashank Agrawal


1 Answers

The fix is to change the following line in mobile-app/src/polyfills.ts:

From:

import './zone-flags.ts';

To:

import './zone-flags';
like image 183
Shashank Agrawal Avatar answered Oct 09 '22 00:10

Shashank Agrawal