Skip to content

A tsconfig that cannot be read is ignored without a warning #844

Closed

Description

@fengmk2

Two cases leave a process with no tsconfig and no warning, so the first sign is an unrelated ERR_MODULE_NOT_FOUND for a paths alias. With a valid tsconfig.json ("paths": { "@lib/*": ["src/lib/*"] }) and no variable, main.ts (import { v } from '@lib/a') prints alias.

A TS_NODE_PROJECT that names a missing file, such as one left over from ts-node:

$ TS_NODE_PROJECT=missing.json node --import @oxc-node/core/register main.ts
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@lib/a' imported from /…/main.ts

A tsconfig.json with a syntax error, here a missing closing brace:

$ node --import @oxc-node/core/register main.ts
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@lib/a' imported from /…/main.ts

tsx resolves the alias in both cases: it ignores TS_NODE_PROJECT and parses the broken file leniently. Reproduced with @oxc-node/core@0.1.7 from npm on macOS arm64, Node.js 24.12.

Suggested fix

Warn once on stderr, naming the file, when an explicit tsconfig path (setTsconfigPath(), TS_NODE_PROJECT, OXC_TSCONFIG_PATH) does not exist, and when a discovered tsconfig fails to parse, with the parse error.

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