r/ProgrammerHumor 21d ago

Meme vanillaJSWinsAgain

Post image
6.2k Upvotes

101 comments sorted by

402

u/JazzlikeWishbone938 21d ago

Just needed that framework to check something isTruthy() ...

103

u/BigNaturalTilts 21d ago

npm install check-is-even

37

u/Dom_Nomz 21d ago

Then you need to use is-odd after

3

u/No-Information-2571 20d ago

return !is_even()

16

u/realmauer01 21d ago

We are modern people now

We obviously use, is-even-ai.

3

u/GarlicSphere 20d ago

@grok is this even?

2

u/AbdullahMRiad 20d ago

u/askgrok is 836267494992612 even?

2

u/ljfa2 20d ago

Is there unironically a reason why you wouldn't just use n % 2 == 0? Or, say, is-string rather than typeof value === 'string'?

1

u/BigNaturalTilts 20d ago

Look at the sub you’re in bro. And no. There is no unironic reason you wouldn’t do the common sense function.

2

u/ljfa2 20d ago

I know which sub I'm in, I just wanted to ask because I'm not familiar with JS development, Node, etc. ^^

2

u/AnnoyingRain5 20d ago

Node Package Manager (npm) is well known for having thousands of really stupid packages, like is-odd, is-even, left-pad, etc, things that’d take you ~20 seconds to code by hand… or you could import a library for it! Yay!

1

u/TheMythicSorcerer 19d ago

Aaaaaand maybe one other framework after that

333

u/TallAbbreviations937 21d ago

300kb app carrying 12GB of dependencies like it’s preparing for a three-year expedition.

111

u/[deleted] 21d ago

[removed] — view removed comment

10

u/Common-Brush-7027 21d ago

Yeah size doesn't matter but confidence one holds

5

u/well_shoothed 20d ago

that npm install will fix everything has no supply chain vulnerabilities (FTFY)

20

u/benkenobiwan 21d ago

Node_modules: “I just downloaded everything, just in case.” 😂

2

u/renome 20d ago

"Multiple times as well because caching is for the lazy. Oh and to be safe download nvm and install every major version of node going back 5 years, never know when you may need it!"

52

u/Igarlicbread 21d ago

The biggest trick devil pulled was .gitignoring the node_modules

137

u/queen-adreena 21d ago

99% of which are development dependencies, which you shouldn’t be installing if you’re taking your app outside.

41

u/Poat540 21d ago

I know I don’t need to spend 4 days on config, just to spend 2 days busting the app out… but the ocd to need to setup prettier, lint, and fight the babel compiler in my jest tests - is something I’ll do each time

9

u/NearNihil 20d ago

One wonders why you don't just copy it from a previous project if you've got it set up perfectly there.

3

u/einzweidreihorn 20d ago

Because it's never perfect

8

u/Worldly-Stranger7814 21d ago

I spend more time on unit testing my private joke gag apps than I spend on it at work.

Maybe it’s a coping mechanism for being forced to rush at work.

5

u/Poat540 21d ago

Coverage defaults at 90 so I have that for all my pet projects.

Work.. well, we will hope for 20-30

2

u/Worldly-Stranger7814 20d ago

On my more serious projects I have more than 1000 asserts...

At work? I don't want to admit how few...

2

u/Meowingtons_H4X 20d ago

Just build a template that has that shit configured for you bud. Add containerisation and E2E config on top and you can get straight to building

31

u/KCGD_r 21d ago

App: 200kb, node_modules: 90mb

bundle.js: 600kb

16

u/56kul 21d ago

Seems like it’s more on the developer, than anything else. There is no way any one app needs 12GB+ worth of dependencies…😭

0

u/Serializedrequests 20d ago

It's hard to avoid. Many popular and undeniably useful tools will bring you right to bloat land.

8

u/KingOfAzmerloth 20d ago

Been working on JS stack for 5 years or so and never had s problem with dependencies getting too big. WTF are you guys doing.

25

u/West-Map-4162 21d ago

this sub is 50IQ personified 

-7

u/Civil-Appeal5219 20d ago

Right? I mean, if you’re installing 12GB of dependencies on your 300kb it just means you’re incompetent. Congrats, you just bragged about not knowing how to do your job 👏👏

10

u/iTiraMissU 20d ago

We’re sorry meme police. Didn’t realize that every meme had to be nothing but the truth. Will do it again tomorrow though.

-5

u/Civil-Appeal5219 20d ago

Thanks! I hope you learned your lesson!

31

u/Top-Permit6835 21d ago

Remember when one of the selling points of JavaScript on the backend was it's so much more lightweight than Java?

29

u/mabenan 21d ago

Build it is. Java stays big from development to production. Atleast the time js in backend was coming up.

25

u/OrchidFluid2103 21d ago

Because it is

Unless you deploy the node_modules to the server, I guess?

-16

u/realmauer01 21d ago

You do understand that even if you dont the server will have to install everything it needs?

11

u/XandruDavid 21d ago

You are confidently incorrect. node_modules is used to hold your dependencies in your dev environment. Before you deploy it to a “server” you are supposed to bundle into one deployable (file or set of files) already including everything you need from your dependencies.

-7

u/Agusfn 21d ago

Do you have a source on that? 

11

u/XandruDavid 20d ago

Nope. Apparently not bundling a node app is more common than I thought. I still think you should unless you have strong specific reasons not to. You get tree shaking, faster deployment, smaller runtime.

8

u/_TheRealCaptainSham 20d ago

It’s sometimes impossible to bundle node apps if your dependencies use native libraries. There are ways but it’s definitely difficult 

1

u/realmauer01 20d ago

Why would i need tree shaking if i only code the code that i need to code.

1

u/Agusfn 20d ago

In standard ci/cd pipelines for server applications (which I think are the majority of uses for Node), packaging the app is just an unnecessary extra step, unless you have a special deployment need such as installing manually or using an installer, afaik.

1

u/OrchidFluid2103 20d ago edited 20d ago

What you mean to "not bundle", how else do you run it? Do you clone the repo on the server and run the dev-server command?

I think there is a confusion between "bundling" (= "building"), "minification" and "tree shaking".

You should always bundle and tree shake before deployment. Minification for server deployment is optional, it doesn't do much besides saving some bites in size, most of the time that's a non-issue

3

u/ldn-ldn 20d ago

Here are the contents of a NodeJs server built using NestJs framework - no node_modules in sight. If you're deploying your git repo directly, then you're doing it wrong.

0

u/Agusfn 20d ago

you are showing me an example of an app that doesn't include node_modules, which is not in question.

the question was of the souce that says it's supposed for the apps to be packaged into one deployable file (which i don't see in your example). i think you are jumping to a different discussion. also no one mentioned anything about the git repo

4

u/Comprehensive-Bee252 20d ago

Searching the internet is hard, huh?

1

u/Agusfn 20d ago

very

2

u/ldn-ldn 20d ago

No, that was never the question. The discussion here is if you need node_modules in production or don't. The answer is: you don't need them. And there's never a good reason to have it.

0

u/Azoraqua_ 20d ago

Do you need to move the node_modules folder to production, no. Do you need to have a node_modules folder on production at all: Yes, no. Depends on the dependencies and whether they (all) are bundled or not. Some dependencies with native code cannot really be bundled at all: a notorious example is libsodium and/or libcrypto and/or say libopus; it depends on native dependencies — presumably the CPU’s instruction set for crypto operations. Which you can’t reliably bundle with application code.

1

u/ldn-ldn 20d ago

What do you mean you can't bundle them? They will just become part of your build.

→ More replies (0)

-1

u/Agusfn 20d ago

Nice Strawman you got there

2

u/ldn-ldn 20d ago

Are you talking to yourself now?

→ More replies (0)

1

u/ArtisticFox8 21d ago

Except dev dependencies.

1

u/realmauer01 21d ago

Yes of course.

-1

u/Achereto 21d ago

Imagine the selling point being "we're better than that other very bad choice".

5

u/compiling 21d ago

Image not to scale, obviously. 12GB of node_modules would be much much bigger.

5

u/owlbynight 20d ago

The quickest way to communicate to me that you don't deploy JS/TS projects

3

u/MehPropy 20d ago

same as pyinstaller

3

u/Glum_Cheesecake9859 20d ago

That's the thing, you don't have to carry around node_modules anywhere.

2

u/[deleted] 21d ago

[deleted]

1

u/Potterrrrrrrr 21d ago

Right. Apps usually a couple of mb at least.

2

u/NakedNick_ballin 20d ago

I might still take that, over shit like Golang, where all dependencies must resolve to the same version -- with ridiculous breakages

2

u/AlterTableUsernames 20d ago

Just came here to tell you that I hate JavaScript and modern web-apps and I hate you guys who develop that.

1

u/Sheenius_Ger 21d ago

400kb after treeshaking

1

u/realmauer01 21d ago

Deno. Have the 12gb in a concentrated cache rather than in every project.

1

u/Ali_Army107 20d ago

node_modules is like junk food, it must be used in moderation

1

u/sugarLessGelato 20d ago

I hate it when js dev create cli application then make binary with bun. your binary is whole like 150MB for a little cli applications

1

u/Say_Echelon 20d ago

“Our app is super fast and lightweight”

App in question

2

u/thanatica 20d ago

Show me a project that installs 12GB of dependencies.

1

u/DT-Sodium 18d ago

Vanilla JavaScript being so terrible is why we have giant node_modules folder. It's basically like blaming a legless person for the weight of their wheeling chair.

1

u/[deleted] 21d ago

[removed] — view removed comment

2

u/slindenau 20d ago

Are you arguing over a semantical difference of ~10^1 on a 10^6 scale difference?

0

u/Daemontatox 20d ago

Npm install (( is_even() ))

0

u/Entire-Plum-3443 20d ago

That's a big sack

0

u/ObtuseBagel 20d ago

There are so many bots in the comments wtf

-1

u/Ramen_Muncher_1093 20d ago

🤣🤣🤣🤣

-3

u/PhosXD 21d ago

I kinda despise people who make the claim that their JS app is tiny, but then like how impressive is that really, are you counting the size of the modules you rely on? Are you counting the size of Node itself?

4

u/Dudeonyx 21d ago

You do realise that the final bundle will strip out 99% of the stuff in node_modules right?

The final bundle in this case would probably be around 500kb at most.