
Ask HN: Why this bloat in Angular? - avighnay
Why does each raw skeletal app generated by Angular need 240Mb of disk space and contains around 32 thousand files 239Mb in the node_modules folder.<p>If Angular is already global, why does it need all these files? And what are they doing?<p>Disclaimer: I am an old timer and really miss the just &#x27;download and unzip&#x27; days of javascript and open source
======
quantummkv
It mostly boils down to the fact that javascript/nodejs does not ship with a
standard library like every other language does. So every project has to
include its own copy of what passes as the standard library (A random
smattering of npm modules).

A casual peek into your node_modules folder will reveal packages such as left-
pad, is-number, is-array etc. Stuff that is pre packaged into the runtime of
any sane language. That's what makes up most of the bulk in any nodejs
project.

------
superasn
It's just how it is. You would find this article particularly insightful (1).
An excerpt from it:

> It’s true. Each installation of Babel includes a picture of Guy Fieri, and
> there is nothing you can do about it.

(1) [https://medium.com/@jdan/i-peeked-into-my-node-modules-
direc...](https://medium.com/@jdan/i-peeked-into-my-node-modules-directory-
and-you-wont-believe-what-happened-next-b89f63d21558)

~~~
avighnay
Thank you, this really says it! But why is the community still accepting it?

~~~
superasn
By the way you can run 'yarn autoclean' which creates a autoclean file that
deletes useless stuff, tests, etc to free up some disk space.

------
romanovcode
It's not related to Angular, it's just how modern frontend works now. Also
when you build it with production it won't be 240mb. Remember that it loads
all dependencies as well as many build dependencies.

In fact Angular team is working on new view engine (ngIvy) that shown to tree-
shaken "Hello World" angular application down to 2.6kb.

IMO your reasoning for complaining is ridiculous, it's like saying "I hate C#,
why do I need to download 6gb Visual Studio that has 64 thousand files in
"Program Files/Visual Studio" folder to build C# application!".

------
avighnay
Found this article on setting up Angular with minimal dependencies

[https://blog.angularindepth.com/setting-up-angular-from-
scra...](https://blog.angularindepth.com/setting-up-angular-from-
scratch-1f518c65d8ab)

[edit] this does not work well with Angular 6 and also it reduces dependencies
only to 100Mb

------
avighnay
This article echoes what I felt and here it is compared against Angular 1
itself

[https://medium.com/dirtyjs/why-angular-2-4-5-6-sucks-
afb3656...](https://medium.com/dirtyjs/why-angular-2-4-5-6-sucks-afb36567ad68)

~~~
danieka
Points 2, 3 and 4 I can agree with but the first point, about Typescript
adding bloat but no value, I think is totally wrong.

Sure, TS is a new language, but if you use ES6 the difference is not that big.
And the "drawback" "to have an IDE for checking errors", that's a win in my
book.

No matter how large or small the application type-checking and a more
structured programming language is invaluable. Also, not having to wonder
about what JS function will work in what browser.

Sure, for a simple app Angular might not be optimal, but if you're building
anything substantial it is invaluable.

------
fiiv
You're likely seeing a lot of the build tooling. Things to convert (from
Typescript/etc to plain JS), bundle (optimised files for prod) and run the dev
environment (static file serving, possibly from memory and not disk, not sure
off the top of my head).

~~~
avighnay
Would that not be in the global Angular module install? why repeat per app
folder?

~~~
fiiv
I am not sure about the specifics of Angular (I hate it), but in this sense it
is similar to other frameworks of the time.

Vue, React, etc all use a transpiler to turn their code into code compatible
with as many browsers as possible. The end result is that the syntactic sugar
and niceties of the more modern JS specs get removed and replaced with their
older counterparts. A popular tool for this is Babeljs.io

Modules themselves are new in browsers as well, so what actually tends to
happen is that they don't just all get concatenated and use global variable
scope but a module essentially becomes an enclosure, and all the enclosures
are linked to one another at compile time. So there is usually no global
variable called "Angular".

So if you generate an Angular app with their CLI, they pre-install all those
build steps (along with Typescript, minification, etc). You get Angular using
the transpiled module system out of the box.

------
muzani
Because it appeals to the demographic who uses it. Power at the cost of size
and weight.

If you care a lot about size, you could use something like Vue.

