Error: "main.dev.ts" and "main.prod.ts" have been deprecated

I get the following message after updating ionic and cordova and trying to run ionic serve:

    ionic-app-script task: "serve" 
    [13:13:52]  Error: "main.dev.ts" and "main.prod.ts" have been deprecated. Please create a new file "main.ts" containing 
                the content of "main.dev.ts", and then delete the deprecated files. For more information, please see the 
                default Ionic project main.ts file here: 
                https://github.com/driftyco/ionic2-app-base/tree/master/src/app/main.ts 

That url did not work for me for the main.ts file. Can someone supply me with the new main.ts file structure or the sample file? Otherwise my app will not run. Thanks.

Although my ionic serve runs and loads my app now, all the styles and functionality are broken. Is there more I have to fix?

Delete main.dev.ts and main.prod.ts and create a main.ts file with the following content:

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app.module';
platformBrowserDynamic().bootstrapModule(AppModule);
5 Likes

I had that but I guess I had to restart Ionic Serve. Thank you to everyone for the help!!

Do you know how we can detect at runtime if we’re using a development or production build? It would be useful for mocking out some functionality during testing.

1 Like

Has anyone experienced a build error after removing the two deprecated files? My build process is not generating main.js files in the www/ directory after updating everything and only having a single main.ts file.

1 Like

i have the same problem with a no existing main.js.
I downgraded to rc3 but same situation.

Yes - same problem (or similar). Build scripts updated to 0.47 and works fine with RC3… but won’t work with RC4 (ionic serve). However Ionic Build works ( I do ionic build --prod)

Just add this main.ts file: https://github.com/driftyco/ionic2-app-base/blob/master/src/app/main.ts