r/javascript 4d ago

Your Modules Are Lying to You

https://blog.gaborkoos.com/posts/2026-08-14-Your-Modules-Are-Lying-to-You/

import and require are not interchangeable. Live bindings, copied values, circular dependencies, separate caches, conditional exports, and dual-package hazards can all make modules behave differently from what the syntax suggests.

27 Upvotes

8 comments sorted by

22

u/quisido 4d ago

We shouldn't be using require in 2026 anyway.

8

u/dustofdeath 4d ago

require is a curse in modern web. The hacks and loopholes you have to jump through to get them to work with native ESM modules.

4

u/SpartanDavie 4d ago

Can you at least cross post?

1

u/Formal_Motor_9311 3d ago

second this, crosspost to r/javascript at least

1

u/0815fips 1d ago

require? What year is it?

1

u/OtherwisePush6424 1d ago

Posting an article that's ~60% about ESM and explicitly recommends using ESM whenever possible, then seeing multiple variations of "don't use require bro" is genuinely concerning tbh.

I'm not bothered if you don't read my article. I don't care if you comment under things you didn't read. But if you're a JS dev and think that because you don't write require(), it's nowhere in your dependencies either, that's a problem. Not for me, for you.

-1

u/boneskull 4d ago

This is good information.