Current Behavior
- Say there's a module
M.js in a package pkg that uses the exports section in package.json to alias/remap internal paths.
- The
M.js file is in the pkg/dist folder, but I put pkg/M.js as the "Module name" in a Node RED custom function
- Node RED will report
Error: Cannot find module at run-time
- The "Require stack" will point to
$node_red_home/node_modules/pkg/M.js which does not exist
Expected Behavior
require('pkg/M.js') obviously work just fine from node, so should be supported by Node RED custom function import.
I believe this line should reference parsedModule.module, so the moduleDir is always a real directory.
Steps To Reproduce
No response
Example flow
No response
Environment
- Node-RED version: affects all versions since RED.import was introduced
- Node.js version: 20
- npm version:
- Platform/OS:
- Browser: