Build ionic PWA with production mode?


#1

I want to build my ionic 3 app as PWA.

I just added “browser” platform and build(ionic cordova build browser).
Upload the folders and files in “platforms/browser/www/” to server.

But console still display “Angular is running in the development mode. Call enableProdMode() to enable the production mode.”.

Any body can help? I dont need cordova actually, but I think add browser platform in correct way other than just use the “www” folder in root.


#2

The cordova browser platform is irrelevant. Maybe worse than that, because I don’t think a single Ionic plugin works on the browser platform. So the cordova browser platform is just unnecessary space in your app.

Build with the --prod flag. See here: https://ionicframework.com/docs/cli/cordova/build/


#3

-> I dont need cordova actually, but I think add browser platform in correct way other than just use the “www” folder in root.

If you won’t be using any plugins (e.g., your building a desktop application):

ionic start big-top --no-cordova blank

See: https://robferguson.org/blog/2017/11/09/build-a-desktop-application-with-ionic-3-and-electron/

Ionic and PWAs: http://blog.ionicframework.com/how-to-make-pwas-with-ionic/

Cordova Plugins: https://cordova.apache.org/plugins/?platforms=cordova-browser


#4
ionic build --prod

That’s all