found 7745962577 vulnerabilities (7653345675 low, 91726393 medium, 817263 high, 73246 critical)
post
Which is of very little importance in most cases, because modern bundlers incorporate treeshaking in order to filter out all the unused code when you're building a production application
Edit: okay well appearently that's controversial for some reason
I didn't know about treeshaking (still unsure what it is exactly since I'm not a js Dev), but I'm guessing it still takes up Gigs of space in the project folder of every Devs PC, duplicated for each project.
It does take a lot of space for devs, but personally I find that absolutely irrelevant, because it's your end user's experience that really matters, and - as a dev - you are most likely to have a much better rig and internet connection than your average Joe.
Sure, in many cases the dev's computer is powerful enough to handle that.
However:
- The more the dependencies, the more likely it is to pull-off a supply chain attack. Any of those thousands modules can be compromised and infect either the user or the developer.
- Not all computers are optimized for working with so many tiny files. Have you ever worked in a company that uses McAfee Antivirus? Even Defender can be a massive performance hit in some cases.
Tree shaking is essentially reducing the amount of included code to only the stuff being used.
Let’s say you have a JAR, DLL, or whatever with 5 functions.
Your application calls function A which also calls function B of the DLL/jar.
Tree shaking says “hmm, if I follow the code execution path, I only need 2/5 functions from the DLL/jar” and discards the remaining 3/5 functions.
This significantly reduces the bundle size (the bundle is what is sent to the browser).
Some use 'pnpm' package manager, alternative to default, where the packages are downloaded once to a central location, and per project directory, it links to the original location so files aren't duplicated saving space
node_modules might take a lot of space on a dev machine, but as op said, only the files used are packed into web artifacts that are deployed.
So 12gbs can end up as 10mb, arbitrary number to highlight significance of tree shaking.
That's the thought I always had: When I develop in Node, I stand on the shoulders of ten thousand microbes.
"Why not write Assembly then?"
Oh, here comes the genius motherfucker with the big-brain counterargument: "Well, if HTML's so great, why not just write everything in Assembly, huh?". Wow, look at you, you clever little prick. Did you come up with that all by yourself? Writing web pages in Assembly is like using a fucking scalpel to slice your overcooked steak: sure, it'll get the job done, but you're gonna look like a complete asshole while you're at it. HTML just works, you absolute tool. It's been the backbone of the web since Al Gore flipped the switch, and it'll still be here long after your trendy framework is rotting in a GitHub graveyard. So take your smartass logic and shove it. HTML's king, and you're just a peasant with a keyboard.
🤣
If you don't believe HTML is enough, check any socialist/communist web page.
I'd like full stack developers to try something. Next time you have an itch for a personal project, see if you can make it with no frontend JavaScript. Just some CSS and HTML forms. All templating handled on the backend. Just try it and see how far you get. Don't worry if it looks like a GeoCities page.
Then try finding places where JavaScript would make it more responsive or better UX in some way. Does the back button still work? Is it actually faster? Does it provide any benefit at all?
Maybe it does, but just try.
I'm a JavaScript developer. But it is fully possible to create a site with no frontend JavaScript
Like many things, you should use JavaScript if you need it. If you don't need remote data sources or live refreshes, pure html and css work perfectly fine and, I would go so far as to say, may even be necessary for resistance web pages.
This is especially true if you're using tor. JavaScript can leak your IP address and sites will work more reliability if you have static content that's refreshed on the back end than using a bloated next.js app taking up RAM.
The vast majority of those are useless animations. Some are even a much worse implementation of something done much simpler with JS and requires significantly more code weighing down the page speed. Some examples of this are the cursor tracking examples which use hundreds of divs in a grid.
While there are some useful examples, it seems like this repo is more of a list of to show off advanced CSS, fancy animations, and designs.
Yeah, those are mostly showing off. They're not really what I'm getting at, either. I more want to challenge people to make useful things simply.
And yes, there are ways that JavaScript can be used to give users a faster and more streamlined experience. The web as it stands is so far past that justification. I swear there's lots of "full stack" devs that haven't a clue how to make a site without React.
Thank the programming gods for tree shaking.
Shake dat thicc tree for me, bb.
We need to bring back system development! Not everything needs to be an electron app!
Me working on basic js:
Well JS, you are an odd fellow, but you run in a browser.
HELP! HEEELP!
This can be fixed by switching from npm to pnpm or bun. They use hard links and a package cache.
This does not fix anything. Your final packaged code is the same.
I'm here still using jQuery and php+sockets for nearly all my needs. Only once in my life I actually needed node
all 13 comments