You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I find the CommonJS/ESM situation to be a disaster, but a few nice modules are ESM only and their maintainers don't want to do CommonJS anymore. Forking all of these modules to support CommonJS may require more effort than supporting ESM in various tools such as Node-Red.
Steps To Reproduce
Install an ESM module, like got using npm i got and import it in a function node. It will fail to load. A CommonJS module fork, got-cjs will load successfully.
I find the CommonJS/ESM situation to be a disaster,
100% agree. It is a complete headache for projects that have to cater for both. I find the approach of some modules to cut off from CommonJS entirely to be counter productive - why force people to rewrite their entire stack just because you don't want to add some meta data to your package.json to support both formats (I know that's an over simplification... but you get my point).
Now, all that said, I did spend some time when we added the External Modules work to the Function node to get it working with both formats - using dynamic imports that worked happily across both.
That said, I know I didn't test with got specifically, so it may be doing something our testing didn't cover.
Hello, this is not working anymore on new Node-Red v4. Previously on version 3 or earlier it worked fine.
Is here another way how to load properly ESM modules?
Activity
knolleary commentedon May 25, 2022
100% agree. It is a complete headache for projects that have to cater for both. I find the approach of some modules to cut off from CommonJS entirely to be counter productive - why force people to rewrite their entire stack just because you don't want to add some meta data to your package.json to support both formats (I know that's an over simplification... but you get my point).
Now, all that said, I did spend some time when we added the External Modules work to the Function node to get it working with both formats - using dynamic imports that worked happily across both.
That said, I know I didn't test with
gotspecifically, so it may be doing something our testing didn't cover.Fix ESM module loading in Function node
Fix ESM module loading in Function node
strbaknxp commentedon Nov 14, 2025
Hello, this is not working anymore on new Node-Red v4. Previously on version 3 or earlier it worked fine.
Is here another way how to load properly ESM modules?
my setup:
NodeJS v24.11.1
Node-Red: 4.0.9
Windows 10 environment.
ESM Library https://github.com/jsonquerylang/jsonquery
Thank you