Build & Serve ionic as a web app


#1

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


#2

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.


#3

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


#4

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.


#5

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?


#6

gulp build --release

works for me.


#7

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


#8

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.


#9

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…


#10

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


#11

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


#12

I would find that supremely surprising.


#13

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


#14

ionic cordova build browser --release

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