Giter Club home page Giter Club logo

Comments (12)

DzmitryShylovich avatar DzmitryShylovich commented on May 18, 2024

How did you build project?

Even with material and ngrx my final bundle is 209kb.

from angular-webpack-starter.

kemsky avatar kemsky commented on May 18, 2024

I guess you are talking about gzipped version?

from angular-webpack-starter.

DzmitryShylovich avatar DzmitryShylovich commented on May 18, 2024

ofc

from angular-webpack-starter.

kemsky avatar kemsky commented on May 18, 2024

My point is that there is no difference between webpack1 and webpack2 builds. They both produce ~800kb raw and ~200kb gzipped. It questions if there is any tree-shaking actually.

from angular-webpack-starter.

DzmitryShylovich avatar DzmitryShylovich commented on May 18, 2024

You should compare it to Rollup instead of webpack1.

from angular-webpack-starter.

kemsky avatar kemsky commented on May 18, 2024

If there is no difference between webpack1 and webpack2 then i don't have reason to migrate. Currently i'm checking angular-cli project to see how far it can go.

from angular-webpack-starter.

DzmitryShylovich avatar DzmitryShylovich commented on May 18, 2024

I've tried to remove all code and modules from this project and check minimum bundle size.

probably there's nothing to treeshake this is why u don't see any difference.

from angular-webpack-starter.

kemsky avatar kemsky commented on May 18, 2024

I was expecting angular source code to get tree-shaked because i believe that there is a lot of unused code in this scenario.

angular-cli

All builds make use of bundling, and using the --prod flag in ng build --prod or ng serve --prod will also make use of uglifying and tree-shaking functionality.

Result is ~700kb but it is not big difference and i could miss something during webpack expreiments.

M. Gechev mentions ~200kb raw size using rollup.

from angular-webpack-starter.

DzmitryShylovich avatar DzmitryShylovich commented on May 18, 2024

CLI uses webpack2 under the hood so its output should be very similar to this starter.

For now Rollup has the best treeshaking mechanism and should give you the smallest bundle.

from angular-webpack-starter.

qdouble avatar qdouble commented on May 18, 2024

@kemsky If you remove preloading from the bare minimum branch so it compiles, it comes out to about ~700kb and 150KB gzipped. First of all, I'd be weary about the supposed differences of rollup builds, without using any extra tricks (closure compiler, and doing other types of hacks that are not standard), once you include polyfills, i.e shim, etc, it comes out to just about the same size. When I did a direct comparison apples to apples comparison myself, the difference was maybe 10-20kb gzipped. Also, the gzipped size is really what matters most... sometimes the rollup build may give a smaller minified size, while being about the same gzipped, so it doesn't make a practical difference.

Webpack is tree-shaking, it's just Angular doesn't currently get a lot smaller without non-standard hacks.

from angular-webpack-starter.

qdouble avatar qdouble commented on May 18, 2024

@kemsky Also note that ie shim alone is like 24kb gzipped... I'm sure many of the rollup size statements are not even talking about a fully working app. Once you have a few modules and components, load up the polyfills, use i.e. shim and other stuff, a 50kb hello-world angular 2 app is a myth in terms of one that actually run in the browser without anything tacked on.

Make sure that any comparison between Webpack and rullup is comparing the size of the exact same thing. Same modules and components and including polyfills and shims. Also make sure you are comparing gzipped sizes. Once you look at it through that lens, I'm sure you'll see they are not far off unless you're doing some additional, non standard tricks.

from angular-webpack-starter.

kemsky avatar kemsky commented on May 18, 2024

@qdouble, i understand you, its approximate comparison, my application is already ~ 1.5MB raw, so +- 50KB do not change anything really.

I just was surprised: AOT, tree-shaking, Webpack 2, online template compiler removed, modules, a lot of configuration - but bundle size is ~ same as it was several months ago when i created Webpack 1 build config. The only reason to use AOT is #11583. I'll wait until rollup/closure compiler get ready for production.

from angular-webpack-starter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.