Ask HN: What is happening to JavaScript with ES6 and friends?
https://news.ycombinator.com/item?id=13205017I've been working on a redesign of one of my websites, which is built with Node.js using Express.js. I've recently also been playing around with TypeScript, and was starting to like it, until the unpleasant stuff below.
I'm hoping that someone can point me in the right direction, or at least offer some insight to the below.
- NPM is great, but why are we now installing web dependencies with it? Bootstrap, Material-Components, etc. I know that there are still "traditional ways" of either using a CDN or downloading a local copy. I've avoided NPM for a while until I wanted to use Google's Material-Components-Web thing. My confusion here's because node_modules is private, so how do I correctly load a front-end asset by referring to node_modules?
- Suggestions for the above were to copy what's installed to a public/static folder, but NPM just spills everything all over the node_modules root now, so how would I know what depends on what?
- There's been the Browserify, CommonJS, RequireJS, WebPack et al. movement, where we are now using "require" and "import" to load modules. I understand the desire to do that, but why is it so complicated for front-end? I created a simple TypeScript file under my public assets, I require/import something, and then when I go to the browser, I get an error about require being undefined. I go to RequireJS website, and have to now learn the nuances of this library before I can get productive. Why should I have to load dozens of dependencies before loading a Hello World with some JavaScript? Is ES5 that broken?
While I appreciate the work that everyone's doing with JavaScript, I really feel like we're taking something fun and "easy" and complicating it. I've been teaching beginner programmers ES5 and earlier at work, and was planning on moving onto ES6 once I'm comfortable with the stuff I've been avoiding, but I'm inclined to change my mind so far.
I really hope someone can shed some light on this :)