Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Ionic 2 builds are so large, even for small / blank apps?

So I'm new to Ionic, and might be missing something. But I started a new blank app like so:

ionic start BlankApp --v2 blank

then added a browser platform:

cordova platform add browser

and then built for production:

ionic build browser

The output looks like this:

> ionic-hello-world@ ionic:build C:\Work\ionic\BlankApp
> ionic-app-scripts build

keywords if/then/else require v5 option
[17:56:25]  ionic-app-scripts 0.0.47
[17:56:25]  build dev started ...
[17:56:25]  clean started ...
[17:56:25]  clean finished in 3 ms
[17:56:25]  copy started ...
[17:56:25]  transpile started ...
[17:56:28]  transpile finished in 3.47 s
[17:56:28]  webpack started ...
[17:56:28]  copy finished in 3.65 s
[17:56:34]  webpack finished in 5.65 s
[17:56:34]  sass started ...
[17:56:35]  sass finished in 1.45 s
[17:56:35]  build dev finished in 10.73 s

You have been opted out of telemetry. To change this, run: cordova telemetry on.

Error loading cordova-browser


Running command: cmd "/s /c "C:\Work\ionic\BlankApp\platforms\browser\cordova\build.bat""


Cleaning Browser project

I was expecting a small js bundle given that this app has nothing in it. Tree-shaking was supposed to have dropped a lot of code and the app was supposed, I think, but be lightening fast.

Unfortunately, that's not what happened.

The platforms/browser/www/build/js directory has a main.js file that is over 4MBs in size. There is also a main.css file with 500Kb of content.

What am I missing? am I looking in the wrong spot?

**UPDATE: ** My issue is that I'm trying to build a progressive web app. If I only wanted to build a mobile app, that'd be fine. But for a web app to download 4MB of stuff before even counting it's own content is crazy, I can't believe that is the state of the union on an RC4 release.

Thank you,

Eduardo

like image 942
Edy Bourne Avatar asked Jan 10 '17 00:01

Edy Bourne


Video Answer


1 Answers

use ionic build browser --prod

like image 118
Richman Avatar answered Oct 09 '22 01:10

Richman