Build & Serve ionic as a web app

Is there a support for building ionic 2 for web? SO to exclude cordova dependencies and clean for using as website

This is something weā€™re investigating down the road, making sure Ionic 2 is setup for things like progressive web apps and possible use cordovaā€™s browser platform to ship browser webapps.

2 Likes

What is the timeline for this. We are really looking forward to do that like right now.

We implemented mobile website using Ionic 1. You can look into www.visitacity.com on mobile web. Itā€™s working fine besides few low priority issues and one major issue: the amount of time it takes for the Ionic bundle to load. Ionic bundle size is ~2.3 MB before compression and itā€™s causing the page to load relatively slow.

We are looking for Angluar 2, Ionic 2 solution tho. As Angluar2 states that one framework for both mobile and web. So it should work on web app right?

gulp build --release

works for me.

Gulp build? Are you using a special build for Ionic 2 app as Ionic CLI should be ionic buildā€¦right?

No, but ionic build itself invokes gulp with the gulpfile, among a number of other things. Unfortunately, it requires a platform argument, and defaults to ā€˜iosā€™ if one is not supplied.

I havenā€™t studied everything else that Ionic CLI does, but gulp build has worked for me for building www (it just bypasses all of the Ionic CLI components). Iā€™d love to hear from an expert whether there is anything wrong with this, and if so, what is the ā€œcorrectā€ way to build a non-platform website version.

well, i could do it by
run ionic serve, then it generates a www Directory, which i used to put on my webserver
i tried it with the cordova geolocation plugin, also seems to workā€¦

1 Like

Hi Yosikal, were you able to optimize the build (minify, uglify, aot etc.)? If so, can you share the steps? Thanks in advance.

So if you upload the www folder to a webserver and you browse it on a mobile phone, native stuff like geolocation and camera work properly?

Sounds very interesting! Iā€™m going to try this ASAP!

Cheers

I would find that supremely surprising.

Itā€™s been a while since the latest response but I find that this build what I need without launching and killing ionic serve:

ionic cordova build browser --release

6 Likes

ionic cordova build browser --release

:smiley::smiley::smiley::smiley::smiley::smiley: