Node: When will CommonJS modules (require) be deprecated and removed?

Created on 19 Jun 2020  Â·  5Comments  Â·  Source: nodejs/node

Just curious if this is planned to happen, or is it something no one is thinking about yet?

ES Modules experimental module question

Most helpful comment

Still way too early to even consider, especially given that ESM is still experimental

All 5 comments

@nodejs/modules has probably discussed this extensively, and so have many other project members.

Sharing my opinion on this: deprecation and removal of CommonJS would be extremely disruptive to the entire ecosystem, and would cause more pain to our users than Python users experienced with migrating to Python 3. As such, deprecation is unlikely to happen in the mid-term future, if at all.

I don’t see any point in ever doing that - CJS isn’t legacy, it’s just one of two first-class module systems in node.

I think it’s too early to come up with a clear timeline for this. We’re just approaching the first non-trivial module based apps being possible (without compiling from something else, at least rewriting imports). And there’s a huge amount of code in the ecosystem and even more so in various companies that’s based on CJS - much of which may be non-trivial to convert to ESM (since ESM lacks certain features and is fully async).

So - I wouldn’t go as far as Jordan and say “never” but I’d say “long enough that it could as well be never at this point”.

Still way too early to even consider, especially given that ESM is still experimental

Seems answered, closing

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Brekmister picture Brekmister  Â·  3Comments

dfahlander picture dfahlander  Â·  3Comments

willnwhite picture willnwhite  Â·  3Comments

cong88 picture cong88  Â·  3Comments

addaleax picture addaleax  Â·  3Comments