Skip to content

next build should not change "module": "node20" to "module": "esnext" in tsconfig #82944

@jfirebaugh

Description

@jfirebaugh

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/nameless-sunset-rd9m85

To Reproduce

This project has "module": "node20" in tsconfig.json. See https://devblogs.microsoft.com/typescript/announcing-typescript-5-9/#support-for---module-node20.

To reproduce the issue, run pnpm exec next build in terminal.

Current vs. Expected behavior

The following is printed:

   We detected TypeScript in your project and reconfigured your tsconfig.json file for you.
   The following mandatory changes were made to your tsconfig.json:

        - module was set to esnext (for dynamic import() support)

And tsconfig is modified.

Expected behavior is for tsconfig not to be modified, since node20, like node16, already supports dynamic import.

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Sun Aug  6 20:05:33 UTC 2023
  Available memory (MB): 4102
  Available CPU cores: 2
Binaries:
  Node: 20.9.0
  npm: 9.8.1
  Yarn: 1.22.19
  pnpm: 8.10.2
Relevant Packages:
  next: 15.5.1-canary.4 // Latest available version is detected (15.5.1-canary.4).
  eslint-config-next: N/A
  react: 19.1.1
  react-dom: 19.1.1
  typescript: 5.9.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

TypeScript

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    TypeScriptRelated to types with Next.js.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions