News for hackers. Stuff that matters.
Re:The state of JavaScript modules by LeoNatan25 on Monday May 29, 2017 @02:46AM (#14437768)
“Most frontend developers still remember the dark days of JavaScript dependency management.”

As opposed to now, where even the smallest “app” has hundreds if not thousands of dependencies for the most basic of functionality (‘need to iterate an array, better bring lodash’), often there being multiple copies of the same dependency due to conflicting versions?

Re:The state of JavaScript modules by bshimmin on Monday May 29, 2017 @04:28AM (#14438059)
You beat me to the punch: I really don't remember "you would copy and paste a library into a vendor folder, rely on global variables, try to concat everything in the right order and still would had to deal with namespace issues" as being all that big of a problem! It was (is!) simple enough, and it mostly worked; if you were trying to deploy something to a customer site where they already accidentally had two different old versions of jQuery loaded in the page, sure, that could be problematic... but deploying stuff to customer sites is always problematic one way or the other.

(I accept this is something of a rose-tinted over-simplification, but a paragraph titled "An ancient fear" probably deserves some slightly flippant commentary.)

Re:The state of JavaScript modules by eloisant on Monday May 29, 2017 @07:17AM (#14438540)
I do remember that being a huge pain in the back, as in:

- You have to maintain a full list of your files, in order, to include them in your html page (in dev mode) and concat (for prod mode)

- If you want to know on what other module a given module depends on, you have to hunt every call in the source code

- You can never remove a dependency on an external lib as you can never be sure it's not used somewhere

- Upgrading a lib was a pain

Compared to every other language, it was a huge pain point. It's not by chance that so many people started to work on implementing modules for JS, there was a real need.

Re:The state of JavaScript modules by bfred_it on Monday May 29, 2017 @04:19AM (#14438036)
Do you prefer handling these conflicts by hand by shuffling global variables?
Re:The state of JavaScript modules by LeoNatan25 on Monday May 29, 2017 @11:45AM (#14439652)
I would prefer there be a comprehensive base library, thus cutting dependencies to a minimum. Beyond that, I would prefer to handle those manually, yes, rather than have multiple versions of these libraries just load into memory. Conflicting dependencies is not a coherent development state.