Why are Ionic 2 builds so large, even for small / empty applications?

So, I'm new to Ionic and may have missed something. But I started a new empty application, for example:

ionic start BlankApp --v2 blank

then the browser platform is added:

cordova platform add browser

and then built to produce:

ionic build browser

The result is as follows:

 > 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 package, given that there is nothing in this application. It was assumed that the tremor of the trees dropped a lot of code, and the application, I believe, was supposed to be, but quickly covered.

Unfortunately, this is not what happened.

In the platforms/browser/www/build/js main.js there is a main.js file larger than 4 MB. There is also a main.css file with 500 KB content.

What am I missing? Am I looking in the wrong place?

** UPDATE: ** My problem is that I am trying to create a progressive web application. If I only wanted to create a mobile application, everything would be fine. But for a web application to download 4 MB of things, before I even consider its own content crazy, I can’t believe that this is the state of the union for the release of RC4.

Thanks,

Eduardo

+6
source share
2 answers

use ion build browser --prod

+7
source

When you think about it a little, it is logical that your assembly is great. This is because inside the assembly there is Cordoba and all its dependencies and plugins. But when you see that main.js and main.css are big enough, it's because of Cordoba, which is trying to host every library, plugins, etc. In the same file.

But you could upload these 2 files, just to make sure I'm right. :)

+1
source

Source: https://habr.com/ru/post/1013927/


All Articles