Can I use the ionic serve in production?

Hi guys,

I am developing a same App for both iOS and Android platforms and also we need a web version. All the functions should be same for different platforms.

For the web version I know ionic server command can start a web server locally for debugging. But not quite sure if this can be used in production environment to provide actual services to end user?

And if so is there any way that I can deploy to different application servers? have no idea what app server the “serve” command use…

The contents of the www directory can simply be served under any application server. I’ve used nginx. Naturally, none of the cordova plugin stuff will work.

1 Like

Hi rapropos, thanks for the reply. looks great! I will have a try on nginx as well.

And I will try to avoid using cordova plugins for example $cordovaAppVersion $cordovaFile in the code.


just did a try. just copy the www folder under the project root to the nginx nodes will just make it work like a charm.

This is an amazing framework!

If you do need some cordova stuff you can get some things to work (like camera for example) if you add the browser platform and build for it.

ionic cordova platform add browser
ionic build browser --prod

Then the source will be in platforms/browser/www
It only works with some plugins, but I’ve had success.

1 Like

I suggest using npm run build --prod instead of ionic serve to create the contents of the www folder before uploading it to a server, because ionic serve does a dev build without Ahead of Time (AoT) compilation and minification.

1 Like

thanks beck24. just know there is even a “browser” platform in ionic. i did a try and it works fine!

I get this now:

$ ionic build browser --prod
The build command has been renamed. To find out more, run:

ionic cordova build --help

And under help they don’t show any commands related to building for the Web anymore… Has the ionic team removed support for building for the web??

Try: ionic cordova build browser --prod

ionic cordova build browser --prod --release worked, thanks!

this creates a new folder under platforms folder called browser. I see platform_www and www, which do I deploy?

the “www” one @phingers