Repository navigation
Closed
Description
Hello.
I have a Typescript Express app using pnpm workspaces and some import aliases (under compilerOptions.path in tsconfig.json), like this:
{
"compilerOptions": {
"paths": {
"common/*": ["./common/*"],
"server/*": ["./server/*"],
"client/*": ["./client/*"],
},
}
}
Today, I use tsx, and invoke my "development mode" server like this:
"server": "tsx watch ./server/server.ts",
I've tried to do the same using oxc-node
"server": "node --import @oxc-node/core/register ./server/server.ts",
But I get import errors like:
node:internal/modules/run_main:123
triggerUncaughtException(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'common' imported from <repo_path>/common/enums/feature-enums.ts
Did you mean to import "<file:///<repo_path>/common/Internationalisation/translation-map.json"?
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:266:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at nextResolve (node:internal/modules/esm/hooks:748:28)
at resolve (file:///<repo_path>/node_modules/.pnpm/@[email protected]/node_modules/@oxc-node/core/esm.mjs:16:10)
at nextResolve (node:internal/modules/esm/hooks:748:28)
at Hooks.resolve (node:internal/modules/esm/hooks:240:30)
at handleMessage (node:internal/modules/esm/worker:199:24)
at Immediate.checkForMessages [as _onImmediate] (node:internal/modules/esm/worker:141:28) {
code: 'ERR_MODULE_NOT_FOUND'
}
Node.js v22.19.0
[nules/run_main:123](node:internal/modules/run_main:123)
triggerUncaughtException(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'common' imported from <repo_path>/server/rootroutes/rootroutes.ts
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:266:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at nextResolve (node:internal/modules/esm/hooks:748:28)
at resolve (file:///<repo_path>/node_modules/.pnpm/@[email protected]/node_modules/@oxc-node/core/esm.mjs:16:10)
at nextResolve (node:internal/modules/esm/hooks:748:28)
at Hooks.resolve (node:internal/modules/esm/hooks:240:30)
at handleMessage (node:internal/modules/esm/worker:199:24)
at Immediate.checkForMessages (node:internal/modules/esm/worker:141:28) {
code: 'ERR_MODULE_NOT_FOUND'
}
Node.js v22.19.0
Any pointers / tips? I wondered if it's a config issue (like oxc-node not detecting my tsconfig.json). If you need a "minimal reproduction" example, I can try to make one.
Thank you again for the great tool!
Reacted by Roger Schönbächler
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Priority
None yet
Activity
Brooooooklyn commentedon Sep 12, 2026
Thanks for the report — and sorry this sat so long. I dug into the whole scenario space against current main; here is where things stand.
The alias resolution itself is fixed on main (not yet in a published release — the last tag,
v0.1.0, predates it):tsconfig.jsonthat actually claims each file, sopathsfrom your root tsconfig apply — including your exact shape (pathswithoutbaseUrl, imports likecommon/enums/feature-enums)..jsonfiles (like yourtranslation-map.json) resolve too.I verified both with a fixture matching your layout: root
tsconfig.jsonwithpaths,server/server.tsimportingcommon/enums/feature-enums, run vianode --import @oxc-node/core/register ./server/server.ts.One thing to check in your repo: each directory that contains importing files needs to be claimed by the tsconfig that declares the
paths— the same ownership ruletscapplies. Ifserver/has its owntsconfig.jsonthat neither declarespathsnor says"extends": "../tsconfig.json", the aliases won't resolve there. That is deliberate TypeScript parity, not a bug.While probing I found a second bug in your command shape — a CommonJS-typed project (no
"type": "module") couldn't run a.tsentry withimportsyntax at all (ERR_REQUIRE_CYCLE_MODULE), and named imports from such files lost their exports. That's fixed in #759.So: the next release containing #569, #745 and #759 should run your setup as-is. I'd leave this open until the release is out, but if you can try a build from main in the meantime, we'd love to hear whether it covers your workspace.
fix: run CommonJS-reported files with ESM syntax as ES modules (#759)