Recently we planned to revamp our existing web-app which is built in JMVC
. And we decided to go with Angular-2.
And to test what will be the load size, I did the following:
ng new test123
cd test123
ng build -prod
And deployed dist
folder content on apache and it showed 1.0MB transferred
.
My entire JMVC application, with all the business logic is hardly 1.2MB when loaded in browser.
What can I do to decrease the size of Angular-2 app after deployment?
If you've done your research and figured out that your app doesn't render that much and doesn't render that often, then your code may just simply be quite slow. This is probably due to some heavy scripting and not DOM-related. Use WebWorkers. The Angular CLI also provides a command to generate a WebWorker in a snap.
Angular is used in public-facing applications and sites such as Google Cloud Platform and AdWords, as well as many internal tools.
As per the comments, the ng2 team are working on reducing the size of framework nearing its release.
Prior to this, following typical http conventions for minimising JS size is obviously the main thing, but I've also found that Webpacks optimisations heavily reduce the size of the generated JS substantially.
Thats 313KB for the entire angular2 code base as well as my entire app which includes inline HTML and Styling (I'm not sure what the result would be for a Hello World example though).
The webpack plugins you can use are
webpack.optimize.OccurenceOrderPlugin(true)
webpack.optimize.UglifyJsPlugin()
webpack.optimize.DedupePlugin()
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With