3 ms·
The two first points don't have much to do with the "language" aspects of JavaScript itself or ES6. NPM (the registry) is simply the winner of a long-running l
by johncoltrane 10y ago
The two first points don't have much to do with the "language" aspects of JavaScript itself or ES6.
NPM (the registry) is simply the winner of a long-running low-intensity conflict to determine the canonical registry for the JavaScript ecosystem. Bower (the registry), is NPM's front end alternative. It is now almost irrelevant but its client essentially works just like the NPM client, installing whole packages and dependencies in `bower_components` (versus `node_modules` for NPM).
Both clients let you choose where to put that directory and/or how to name it but you will undoubtedly end up with a lot of useless/potentially harmful files coming from dozens and dozens of untrusted third parties to manage in your `public` directory. That sucks hard.
The only working solution to that problem is to use a bundling mechanism. You keep all your third party packages and their dependencies private as well as all your sources, and only deliver to the browser a couple of bundles that only contain what's strictly needed: `main.js` and `main.css`.
But now you have to choose a bundler.
And the module pattern you will use throughout your project.
And the JS flavor.
ES5 is no more broken than ES3 was and ES6 doesn't really fix anything in ES5. If you want to find something broken, take a look at the JS ecosystem instead.
Hyper modularizing your code and juggling with `exports` and `require()` can be useful but it's definitely not the only way to write a working website.
- nevi-me 10y agoThanks for the explanation. I understand the rationale (if any), but the irritating part is when one sits down and tries to get stuff done. The mere fact that there are a lot of ways of doing something, with one tool having many variants, is a pain. I thought of pointing my NPM installs to a different folder, but that felt like a hack for something that should be simple. I tried out WebPack, but was getting silly errors that were leading me to keep on searching for solutions. I eventually just copied over the files that I need, and overriding 'require' with a function that returns null, just so I could at least get some stuff done without worrying about too much for now. I'll spend more time in the coming days trolling Github to see how some people are doing things. > ES5 is no more broken than ES3 was and ES6 doesn't really fix anything in ES5. If you want to find something broken, take a look at the JS ecosystem instead. That's my feeling too, it's like we're creating stuff just because other languages have it too.
- johncoltrane 10y agoBelieve me, making choices as a technical leader is really hard these days.