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
.tsx and .jsx files in a "type": "module" package run as CommonJS #797
$ node --import @oxc-node/core/register main.tsa.ts undefined undefinedb.tsx function object
Expected b.tsx undefined undefined. A .jsx file in the same package behaves the same way (function object).
Files with import/export are flipped to ES modules later by load_commonjs_esm, so this hits .tsx/.jsx files without module syntax. Such a file runs with require, module, and this === module.exports in scope, and the automatic JSX runtime is emitted as require("react/jsx-runtime"), which goes through Node.js' CommonJS resolution instead of the resolve hook (tsconfig paths do not apply).
Environment: @oxc-node/core 0.1.4, Node.js 22.18.0, 24.21.0, and 26.5.0, macOS arm64.
Cause
The resolve hook takes the format from resolution.module_type() (src/lib.rs#L990-L994) and defaults to commonjs. oxc_resolver's ESM_FILE_FORMAT applies the package type only to .js and .ts and returns None for .jsx and .tsx.
Suggested fix
For jsx and tsx, fall back to the package type: resolution.package_json().and_then(|p| p.r#type()). Alternatively, oxc_resolver could cover .jsx/.tsx in module_type.
Activity
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch
fix(oxc-node): carry the vendored source changes as a patch