# Allow node runtime files to be named \*.cjs not jusst \*.js

**URL:** https://discourse.nodered.org/t/allow-node-runtime-files-to-be-named-cjs-not-jusst-js/87521
**Category:** Feature Requests
**Created:** [26 April 2024 14:07 UTC](https://discourse.nodered.org/t/allow-node-runtime-files-to-be-named-cjs-not-jusst-js/87521 "2024-04-26T14:07:46Z")
**Posts on this page:** 2
**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: [26 April 2024 14:07 UTC](https://discourse.nodered.org/t/allow-node-runtime-files-to-be-named-cjs-not-jusst-js/87521/1 "2024-04-26T14:07:46Z")

</div>

As we gradually get closer to starting to move over to ESM in Node.js, we really should be able to name our code using the existing standards built into Node.js

The `.cjs` extension has been supported for quite some time now but the `require()` function does not automatically recognise `.cjs` extensions, you have to supply them directly.

So while it is common to require modules without the `.js` extension, this is becoming less supportable in the mixed economy of CJS/ESM.

This request should be a fairly small change to include file extensions when requiring nodes into Node-RED and would provide much greater flexibility for node authors as they start to convert from CJS to ESM.

---

<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: [25 June 2024 14:08 UTC](https://discourse.nodered.org/t/allow-node-runtime-files-to-be-named-cjs-not-jusst-js/87521/2 "2024-06-25T14:08:28Z")

</div>

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