You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
./dep.js and ./dep resolve to dep.js before dep.ts, unlike tsc and tsx #840
When dep.js and dep.ts sit side by side, both ./dep.js and ./dep resolve to dep.js. tsc and tsx resolve both to dep.ts. A project that compiles in place, or keeps generated .js next to its sources, therefore runs stale output.
$ cat dep.js dep.ts main.tsexport const v = 'js';export const v = 'ts';import { v as a } from './dep.js';import { v as b } from './dep';console.log('dep.js ->', a, ', dep ->', b);
$ node --import @oxc-node/core/register main.tsdep.js -> js , dep -> js
$ tsx main.tsdep.js -> ts , dep -> ts
Relatedly, ./x.js maps to x.tsx but not to x.jsx: with only dep.jsx present, import './dep.js' fails with ERR_MODULE_NOT_FOUND, while tsx loads dep.jsx. Reproduced with @oxc-node/core@0.1.7 from npm on macOS arm64 with Node.js 24.12, and on 22.18 and 26.5 through an embedder that compiles in v0.1.7.
Cause
The resolver options (src/lib.rs#L2199-L2216) put .js first in the .js extension alias ([".js", ".ts", ".tsx"]) and before .ts in extensions, and the alias has no .jsx.
Suggested fix
For importers outside node_modules, try .ts and .tsx before .js, in the alias and in the extension list, as TypeScript's resolution does, and add .jsx to the .js alias. Inside node_modules the current order matches what packages publish.
Activity
feat(vpx): run TypeScript scripts with the vendored oxc-node (#2936)
fix(core): run the .js file the entry point or a JavaScript importer …
feat(core): compile ES module syntax to CommonJS where tsc would (#905)…