When programmatically generating a path for importing with await import(), Nitro does not compile the imported file correctly.
const { default: _App } = import("src/App.jsx"); // 👍 `src/App.jsx` converted to `js` and imported
const { default: _App } = import(path.resolve(process.cwd(), "src/App.jsx")); // 👎 `src/App.jsx` not compiled
const { default: _App } = import(`${'/home/projects/node-ru2nde/src/App.jsx'}`) // 👎 `src/App.jsx` not compiled
Additional context
No response
Logs
Unknown file extension ".jsx" for /home/projects/node-ru2nde/src/App.jsx
at __node_internal_captureLargerStackTrace2 (https://noderu2nde-alzg.w-corp-staticblitz.com/builtins.ddb8d84d.js:101:5335)
at new NodeError (https://noderu2nde-alzg.w-corp-staticblitz.com/builtins.ddb8d84d.js:101:4149)
at Object.getFileProtocolModuleFormat [as file:] (https://noderu2nde-alzg.w-corp-staticblitz.com/builtins.ddb8d84d.js:149:1318)
at defaultGetFormat (https://noderu2nde-alzg.w-corp-staticblitz.com/builtins.ddb8d84d.js:149:1953)
at defaultLoad (https://noderu2nde-alzg.w-corp-staticblitz.com/builtins.ddb8d84d.js:153:1154)
at ModuleLoader.load (https://noderu2nde-alzg.w-corp-staticblitz.com/builtins.ddb8d84d.js:154:3400)
at ModuleLoader. (https://noderu2nde-alzg.w-corp-staticblitz.com/builtins.ddb8d84d.js:154:2452)
at new ModuleJob (https://noderu2nde-alzg.w-corp-staticblitz.com/builtins.ddb8d84d.js:155:876)
at #s (https://noderu2nde-alzg.w-corp-staticblitz.com/builtins.ddb8d84d.js:154:2337)
at ModuleLoader.getJobFromResolveResult (https://noderu2nde-alzg.w-corp-staticblitz.com/builtins.ddb8d84d.js:154:2195)
at ModuleLoader.getModuleJob (https://noderu2nde-alzg.w-corp-staticblitz.com/builtins.ddb8d84d.js:154:1965)
at async ModuleLoader.import (https://noderu2nde-alzg.w-corp-staticblitz.com/builtins.ddb8d84d.js:154:2646)
Environment
Reproduction
stackblitz.com/edit/node-ru2nde
Describe the bug
When programmatically generating a path for importing with
await import()
, Nitro does not compile the imported file correctly.Additional context
No response
Logs