Skip to content

./x.jsx does not resolve to x.tsx or x.ts #873

Closed

Description

@RaphaelFakhri

Outside node_modules, an import that names a .jsx file fails when only the TypeScript source exists. tsc and tsx resolve ./x.jsx to x.tsx, then x.ts, the same way ./x.js already resolves to x.ts and x.tsx here.

Reproduction

$ cat App.tsx util.ts main.ts
export const v = "tsx";
export const w = "ts";
import { v } from "./App.jsx";
import { w } from "./util.jsx";
console.log(v, w);

$ node --import @oxc-node/core/register main.ts
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '.../App.jsx' imported from .../main.ts

$ tsx main.ts
tsx ts

tsc --traceResolution (TypeScript 5.9, moduleResolution: nodenext) reports:

Module name './App.jsx' was successfully resolved to '.../App.tsx'.
Module name './util.jsx' was successfully resolved to '.../util.ts'.

Reproduced on main (4759ced) with Node.js 22.23 on Linux x64.

Cause

source_order in src/lib.rs gives .js, .mjs and .cjs an extension alias, but not .jsx. tsc tries .tsx, .ts, .jsx, then .js for a .jsx specifier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions