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


#1

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.


#2

#3

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


#4

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

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


#6

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.


#7

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.


#8

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


#9

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)


#10

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