[Ionic2] Best practice to deploy mobile WEBSITE?


Hi all,

So the ionic2 release says the below

Ionic 1.2 marks the first release where we actively recommend Ionic for those looking to build a mobile website

I have been working on a little ionic2 project the last day or two… and everything is working on iphones/android/pc chrome when I connect to the “ionic serve” test server.

My question is though, how do I just deploy this to any normal web server? Am I missing something?

  • The code in the [rootproject]/www is incomplete, there are not transpiled typescript files. If I were to transpile manually in my app/ and move them over, would that be all that’s needed?

  • I have tried “ionic build browser” and then I go into the “/platforms/browser/” and again try to load up the index.html from the root… the www… the platform_www always tons of errors. I’m doing this from a sample project so nothing fancy is going on.

This can obviously be done, as I’m running it like a mobile website in all of these devices for testing… what am I missing here?

I just don’t see any guidance in the ionic docs, even though as I clearly linked above they are saying this can be used directly for mobile website use.

Thanks a lot for any help.


I had some similar confusion regarding the “browser” platform(?). I read in CLI help that the “browser” command has been deprecated, replaced with the Cordova Crosswalk plugin. I think to the CLI, browser means something different than “desktop browser.”

I don’t know that I’d call it “best practice”, but you might try “gulp build” (assuming you have gulp in your executable path) to simply build the app; it works for me, and outputs to www/. “ionic build” requires a “platform”, and defaults to assuming you want the iOS platform and trying to install that for you. I’m not sure what other stuff “ionic build” does, but “gulp build” will simply run the “build” task from gulpfile.js, which includes TypeScript transpilation via the buildBrowserify task. Your app code should then all be transpiled and concatenated into www/build/js/app.bundle.js, along with all the other JS resources.


Short answer to this question is now (as of Ionic 3, and maybe Ionic 2):

npm run build --prod
ionic build --prod

This will create an output ‘www’ folder containing a production-ready (minified, tree-shaken, ahead of time compiled) distribution of your app ready to push to a web-server www/ folder.


I created a ionic2 project which is working fine in web browser(desktop) for development and working fine in Android and IOS. But my question is how to make this project available to the customer by hosting in Server as a desktop web application. When I referred many posts it says www folder is all ready for production once “npm run build --prod” is done. Can you please explain how could be done in detail. Thanks in advance!


Use that. Follow the instructions. Put the files from the www folder into the repo and upload it.