Node resources ESM loading issues

Hi, I noticed this with Node-RED v4 and it persists with v5. I had hoped that the issue would be resolved with the newer release.

If loading the node's Editor script as a resource using ESM, not everything works as expected. e.g.

<script type="module" async src="./resources/@totallyinformation/node-red-inline-debug/inline-debug.mjs"></script>

Note that it doesn't make any difference if you use async or not, the issues are the same.

Issues:

  1. In the HTML file, using something like <span data-i18n="debug.output"></span> does not get translated. It works if the script is loaded as a normal script, but not as a module. You get no output.

  2. The resource script does get loaded and run as expected. However, the color setting of the node does not get applied either in the palette or in the editor.

As far as I can tell so far, everything else works as expected.

This isn't just related to the ESM resource, but to all scripts loaded by the editor. They are all loaded asynchronously.

Thanks. However, there is still an issue when trying to load a node's Editor script as an ESM.