70 points · by mwanago · 8y ago · 65 comments
A vanilla install of Phoenix with Brunch yields a node_modules with 388 packages. What are the odds of one of them becoming rogue due to a hack, and how would I know?
Add to this the overall (perhaps perceived) fragility of having to maintain a node project and fumbling with JavaScript. Node was a great new thing for server-side stuff, but whose idea was it to start using it for building every single command-line tool?
Look at what Phoenix (https://hexdocs.pm/phoenix/overview.html) and Brunch (https://brunch.io/) can do. To suggest 388 packages for all that stuff is too much is ridiculous - there's a lot of functionality, so there's a lot of code. The fact that it's not one huge, opaque blob is a good thing. Could they be implemented with less code? Maybe. Does that mean they'd be better for it? I don't think I've ever come across a reasonable argument that says 'less code is always better'.
You could very reasonably argue that you don't need all those features, and maybe the two things are bloated. I would suggest that means you've picked two things that do way more than you need, and you've not chosen your tech stack very well.
It has one dependancy.
No, there are 2 reasons for this dependency creep:
- the fact JS has a so few features and such a little stdlib. So everyone has to rewrite even basic stuff.
- the community culture toward stability, maintenance and future proofing is almost inexistent in JS.
Too many JS devs have only ever coded in JS. This give them have a very twisted, unbalanced view of programming.
"very new line of code you willingly bring into the world is code that has to be debugged, code that has to be read and understood, code that has to be supported. Every time you write new code, you should do so reluctantly, under duress, because you completely exhausted all your other options. Code is only our enemy because there are so many of us programmers writing so damn much of it. If you can't get away with no code, the next best thing is to start with brevity."
More code, more bugs, more issues. 388 packages is ridiculous compared to practically every major system including operating systems. Javascript is Stockholm syndrome.
A several horrific hours of googling how to fix its configs so that it just works
Did Webpack do that or did Babel?
Does it, though? No project of moderate complexity will be able to reuse a Webpack config. Conversely, how large of a problem was this for simple sites?
I looked at doing it with webpack but frankly 2 lines of bash that'll work the same in a decade vs haha no wasn't a hard choice.
A question you’ll find yourself Googling every month as the “best approaches” change.
WebPack 1.x was very powerful but very difficult to understand and configure. There weren’t a lot of sane defaults and the docs did very little to adequately explain the core concepts. The problem(s) WebPack wolves are pretty complex and I haven’t seen anything else do quite what it does.
Starting with 2.x, the docs are great. They explain the concepts pretty well. They give you basic setups and examples throughout. 2+ also has a simplified base config: you only need a few items in your config to start getting some pretty big benefits.
While WebPack was not the first and certainly isn’t the only tool that provides what it does, it does provide a sort of one stop shop for a lot of what used to be separate tools. I don’t feel like it locks me in however.
Along with the ability to minify and other such “utility” functions (which you don’t have to do with WebPack), you get things like tree shaking. This can drastically shrink your final bundle.
As someone who does a lot of UI development, it’s also nice to be able to use ES2015 features like import without having to worry.
tl;dr I see complaints about WebPack being complicated and config heavy. It used (1.x) to be exactly that. It’s much better and the benefits from using it far beyond worth the (now little) upfront learning IMO.
Now... that doesn't really favor Webpack. And I still don't quite understand why that tool is so popular.
That's just back to Gulp.
create-react-app and vue-cli and much better designed in that regard. And yet they are using webpack.
External projects manage to be better at webpack than the webpack team.
The JS ecosystem looks like an isolated entity that contracted amnesia and a learning disability. It then proceeded to remake every single mistake done in 30 years of prior art, while ignoring every other communities warning again and again about it.
And to add insult to injury, devs from the community answered that everything was fine, and that it was us who didn't understand, and failed to live in modern times.
It's getting better. But it took a while because so many JS devs have only ever coded in JS, giving them an incomplete and crooked big picture.
Essential complexity in this case is just a need to run a code. That's it. I just want to run one command, with one or two switches max, and get the result running in a browser.
Accidental complexity is when you have a tool that 99% of developers couldn't quickly grasp and need to spend many hours studying courses or reading books (!) on Webpack.
Someone should stop this madness.
Back in 1975 (43 years ago!) Tony Hoare said:
"The pursuit of complexity is easy... But the pursuit of simplicity is one of the most difficult and challenging activities of the human mind. Progress is likely to be extremely slow, where each complexity eliminated must be hailed as a breakthrough. We need not only brilliance of intellect but breadth of experience, nicety of judgement, excellence of taste, and even more than our fair share of good luck. And finally we need a puritanical rejection of the temptations of features and facilities, and a passionate devotion to the principles of purity, simplicity and elegance."
All of those things I see as being essential to building quality code in a reasonable amount of time (and enjoying it), and all of those things are actually really easy to set up in Webpack (it's all in their docs). Webpack was overwhelming before I read through their docs, and their docs are not as nice as VueJS's docs, but it isn't as bad as everybody makes it out to be. Really.
So, why don't you just double click your index.html? Or is there more to the problem statement?
If there ever a need for red blinky text that quote is it. That is exactly what is happening. And JS fan boys get pissed about it when you point at it.
Webpack is not.
Webpack is basically a task runner, a bungler and a configuration system. It relies on plugins to do anything hard.
The fact it's breaking compat again is so few years itself is alarming.
But it's crazy that a tool that only glues things together is still unable to provide a better API that it currently is.
That doesn't make it good.
It's like JS itself: it's a horrible language, but it's the only one that runs natively all popular web browsers.
When you have a monopoly, you don't need to be good. You just need to be here.
It also has a fantastic summary at the end describing what's wrong with Webpack and how to write better tools.
https://blogs.msdn.microsoft.com/webdev/2018/04/17/library-m...
npm Inc recently joined TC39 so maybe that will change. Also if deno takes off, it's ES6 modules only.
Also, I noticed when the display area is resized, the slider resets (with animation) to the first slide, while the bottom text stays the same.
https://github.com/TypeStrong/ts-loader/tree/master/examples...
https://github.com/TypeStrong/ts-loader/tree/master/examples...
https://github.com/TypeStrong/ts-loader/tree/master/examples... (written by Kenneth Chau of the Outlook.com team)
You may of course you may be using another typescript loader (there are several!). I thought it worth sharing in case you are using ts-loader and your config is catching you out.
Best of luck!
because of that, plus now it is also used for frontend, it is no surprise the "packaging" tool becomes mandatory and complex.
so it's not really webpack's fault.