Live data from Hacker News

Huge no. of files for Angular 2

stackoverflow.com

31–40 of 105 posts

Re: Huge no. of files for Angular 2

#31
post #19

Earlier quoted context omitted.

Hope this comment stays at the top before all the "wow JS sucks!!!" people arrive :-) Though to be fair a "modern" JS dev environment does use a ton of stuff! IIRC Angular 2 production builds are actually pretty efficient.

> Though to be fair a "modern" JS dev environment does use a ton of stuff! Though to be fair a "modern" JS dev environment does use a ton of unnecessary stuff! I fixed your comment.

Eh, transpiling ES2015+ to ES5 is not unnecessary if it makes you more productive—Babel is just really big.

Re: Huge no. of files for Angular 2

#32
I started working with Laravel not long ago and found my project folder had 24,000+ files in it. And those don't compile down before you deploy... it makes me feel like I'm working on the tip of an unstable iceberg. Who the hell knows what's going on down there. No one person could possibly hope to know what it all actually does.

Re: Huge no. of files for Angular 2

#34
post #19

Earlier quoted context omitted.

> Though to be fair a "modern" JS dev environment does use a ton of stuff! Though to be fair a "modern" JS dev environment does use a ton of unnecessary stuff! I fixed your comment.

Eh, transpiling ES2015+ to ES5 is not unnecessary if it makes you more productive—Babel is just really big.

Well to be fair, does anyone expect a compiler to be small?

Re: Huge no. of files for Angular 2

#35
post #28
post #25

Earlier quoted context omitted.

https://github.com/alexanderGugel/ied

I was just about to write a comment to ask why it can't be done like this (using CAS / symlinks). So I guess it can. Are there any disadvantages to using ied over npm?

It's not fully stable yet. I tried a while ago, and after running into 3 showstoping bugs (and filing bugreports) i had to give up.

Great idea though, and it probably has improved a bunch since then.

This is one of the reasons why I love the JS ecosystem. You can even choose among a few tools you use to install packages from a package manager.

Re: Huge no. of files for Angular 2

#36

Earlier quoted context omitted.

Eh, transpiling ES2015+ to ES5 is not unnecessary if it makes you more productive—Babel is just really big.

Well to be fair, does anyone expect a compiler to be small?

https://gitlab.com/Rich-Harris/buble

Buble says "Files (940 KB)" but it doesn't do everything Babel does (just a strict subset).

Re: Huge no. of files for Angular 2

#37
post #28
post #25

Earlier quoted context omitted.

https://github.com/alexanderGugel/ied

I was just about to write a comment to ask why it can't be done like this (using CAS / symlinks). So I guess it can. Are there any disadvantages to using ied over npm?

Private modules seem to be an issue at the moment, but a PR for this is pending.

I used it successfully in a project and it even worked with native modules.

Re: Huge no. of files for Angular 2

#38

Why isn't npm managing packages like ruby gems? SHARED_DIR/npm_modules/NAME/VERSION

Because package-lookup and the package manager are 2 completely separate systems in javascript.

When you `require` or `import` a file in node.js, it looks for a node_modules and looks for that name in there. If it can't find it there, it starts walking up the directory tree until it finds something it can use (to a point).

This is hardcoded and will be extremely difficult to change without a crazy amount of breaking.

The package manager is free to install however, but it needs to put things where the package-lookup can find them.

Re: Huge no. of files for Angular 2

#39
babel 6 with jsx transformer used to install a comparable number of files due to module duplication. At one point it was a 100M install with some modules being duplicated 45 times. Much of this was the fault of npm 2. But with latest babel and npm 3 it's now a 35M install with 5700 files over 814 directories. I guess that's considered lean by modern standards.

Re: Huge no. of files for Angular 2

#40

Is there a "distribution" bundle convention for npm ? Analogous to static linking, it would be one .js file that would bind all dependencies into a bundle (e.g. gulp.dist.js) . In that case you would end up with a much smaller number of dependency files to manage.

There is for your final output (meaning the stuff you would upload to the server and serve to the user). but not for the development.

IMO it's a pretty big anti-pattern to do that. It just hides the problem of managing dependencies (see, it's not 10,000 files, it's just one!), but doesn't fix any of the issues associated with it.

Keeping each dependency small, and having tons of them means that deduplication can work better, tree shaking works better, and it lets you do things like swapping out one package for another with the same API.

Post reply on HN