# Transitioning to ESM from CommonJS - requires at least Node.js v20

**URL:** <https://discourse.nodered.org/t/transitioning-to-esm-from-commonjs-requires-at-least-node-js-v20/97400>\
**Category:** Feature Requests\
**Created:** [3 June 2025 16:15 UTC](https://discourse.nodered.org/t/transitioning-to-esm-from-commonjs-requires-at-least-node-js-v20/97400 "2025-06-03T16:15:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [3 June 2025 16:15 UTC](https://discourse.nodered.org/t/transitioning-to-esm-from-commonjs-requires-at-least-node-js-v20/97400/1 "2025-06-03T16:15:46Z")

</div>

I was just catching up on the status of Node.js ESM/CJS compatibility.

> **[bridging-commonjs-and-esm-in-nodejs.pdf](https://github.com/joyeecheung/talks/blob/master/webhackfest_2025/bridging-commonjs-and-esm-in-nodejs.pdf)**

I now see that the the integration has been back-ported all the way to Node.js v20 - but not v18. And also v18 is already end of life.

So _are there plans to release a Node-RED v5 soon so that node developers can begin to use the ESM/CJS integration to begin transitioning to ESM_? That would, of course, also enable Node-RED core to also start to transition.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [3 June 2025 16:41 UTC](https://discourse.nodered.org/t/transitioning-to-esm-from-commonjs-requires-at-least-node-js-v20/97400/2 "2025-06-03T16:41:13Z")

</div>

At the moment, we're on the cusp of 4.1-beta (days away). There is a case to be made for this to actually be 5.0; however, there are some other potentially breaking changes for 5.0 that we don't have the bandwidth for currently and I wouldn't want to delay getting non-breaking changes released because of that.

Once we have 4.1 out of the way, we'll refocus onto 5.0 soon after.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [3 June 2025 16:44 UTC](https://discourse.nodered.org/t/transitioning-to-esm-from-commonjs-requires-at-least-node-js-v20/97400/3 "2025-06-03T16:44:11Z")

</div>

Hi Nick, thanks for the rapid response.

At risk of being a pain (as usual!), could I ask that you rethink whether 4.1 could be 5 with the only breaking change being the uplift of node.js to the current node.js v20 LTS?

It would open a load of possibilities.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [3 June 2025 16:45 UTC](https://discourse.nodered.org/t/transitioning-to-esm-from-commonjs-requires-at-least-node-js-v20/97400/4 "2025-06-03T16:45:33Z")

</div>

That would then push back the opportunity for other potential breaking changes by a year.

What possibilities are you wanting to unlock? You know you can set an 'engines' property in your module to require Node 20? Not perfect, but would bridge the gap.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [3 June 2025 16:49 UTC](https://discourse.nodered.org/t/transitioning-to-esm-from-commonjs-requires-at-least-node-js-v20/97400/5 "2025-06-03T16:49:21Z")

</div>

> [@knolleary](#):
>
> What possibilities are you wanting to unlock?

I would really like to start working on moving my nodes from CJS to ESM so that I can eliminate some final dependencies and to standardise on ESM so I don't keep having to waste energy mentally converting and working round integration issues.

But even more importantly I would think would be the ability for contributors to core to start work on the move to ESM.

> [@knolleary](#):
>
> You know you can set an 'engines' property in your module to require Node 20? Not perfect, but would bridge the gap.

And if you would relax the node checker rules to allow nodes to be the current node.js OR ABOVE, then that would meet the needs for my own nodes anyway.

Actually, I'm not sure it would - unless there is a clear way to write a node as a Module - and I'm not sure that is yet possible?

---

<div class="post-metadata">

**Author:** ![AllanOricil](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/allanoricil/32/106911_2.png) [@AllanOricil](https://discourse.nodered.org/u/AllanOricil)\
**Post date:** [3 June 2025 18:18 UTC](https://discourse.nodered.org/t/transitioning-to-esm-from-commonjs-requires-at-least-node-js-v20/97400/6 "2025-06-03T18:18:08Z")

</div>

I have a use case where I used esbuild to output esm and it didnt work, even with node 22. The build runs without any issues, but as soon as one of my nodes receives a message an error saying something "dynamic import blablabla does not work" was thrown. I had to fallback to cjs. The issue was comming from an esm only package "aws-cdk-lib"

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [2 August 2025 18:18 UTC](https://discourse.nodered.org/t/transitioning-to-esm-from-commonjs-requires-at-least-node-js-v20/97400/7 "2025-08-02T18:18:12Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
