Blank page with production build on browser


#1

Hi all,

I have a problem with my app, but only when I use the --prod flag with ionic cordova run browser.
Angular doesn’t fill the <ion-app> tag, so the browser render a blank page.

In dev environment (without the --prod), there is no problem.

From what I understand, the --prod does nothing by itself, but activate a bunch of other options (AOT, JS and CSS minifiers and JS optimizer).
Upon a little investigation, I found that my bug was caused by the js minifier. The option --minifyJs does not seem to work in the CLI, but I did a dirty workaround to force context.runMinifyJs = true in config.js.

Does anyone had the same problem ? Or has an idea to solve my problem ?

Thanks !

Edit: I found out that it’s likely to be caused by the import of moment. I’ll update this post when I’ll have more news…


#2

Hey,
Same here, using Moment in a project & using --prod, blank page after the splash screen. Interested to hear what you discover!
thanks


#3

Hi,
I solved my problem by updating moment to 2.19.1 and importing moment with :

 import moment from 'moment'

I set the locale like this :

 export class AppModule {
    constructor() {
        moment.locale('fr')
    }   
}

Hope it helps !