Skip to content

Support .mjs node files in template derivation - #5920

Merged
knolleary merged 2 commits into
node-red:mainfrom
sankalpsthakur:cursor/mjs-node-template-derivation-04ae
Oct 7, 2026
Merged

knolleary merged 2 commits into
node-red:mainfrom
sankalpsthakur:cursor/mjs-node-template-derivation-04ae

Conversation

@sankalpsthakur

@sankalpsthakur sankalpsthakur commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Proposed changes

loadNodeConfig still derived the editor template with /\.c?js$/, so a *.mjs entry point left node.template pointing at the JavaScript file. The editor then never saw data-template-name, and the node was missing from the palette.

This extends that substitution (and the matching local filesystem scan/name derivation) to /\.[cm]?js$/, so .mjs is handled like .js and .cjs.

Fixes #5897.

Checklist

  • I have read the contribution guidelines
  • For non-bugfix PRs, I have discussed this change on the forum/slack team.
  • I have run npm run test to verify the unit tests pass
  • I have added suitable unit tests to cover the new/changed functionality

Validation

npm run test on the fork passes on Node 22 and 24 at 6ce127cc: 2,847 passing and 60 pending tests on each, including the new .mjs regression. The command includes build, dependency verification, lint and coverage tests. EasyCLA passes.

Codex assisted with this description and the isolated validation workflow.

Extend .js/.cjs filename handling so .mjs node entry points resolve
the matching .html template and module name.
@linux-foundation-easycla

linux-foundation-easycla Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: sankalpsthakur / name: Sankalp Thakur (6ce127c)

@sankalpsthakur
sankalpsthakur marked this pull request as ready for review September 1, 2026 21:40
@sankalpsthakur
sankalpsthakur marked this pull request as draft September 2, 2026 00:23
@sankalpsthakur
sankalpsthakur force-pushed the cursor/mjs-node-template-derivation-04ae branch from 6d9e31f to 6ce127c Compare September 3, 2026 20:53
@sankalpsthakur
sankalpsthakur marked this pull request as ready for review September 12, 2026 08:52
@knolleary
knolleary merged commit d8d13d6 into node-red:main Oct 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

loadNodeConfig template derivation still misses .mjs — remaining half of #5220

2 participants