Skip to content

Don't default moduleResolution to node10 for Typescript 6.0 #3147

Open

Description

@scottohara

Description

Typescript 6.0 deprecates "moduleResolution": "node10" and also defaults "module": "esnext" (which in turn defaults "moduleResolution": "bundler" if not specified).

This means that projects that previously had "moduleResolution": "bundler" in their tsconfig.json can now remove that value as it is the default.

However the language server seemingly still sets node10 as the moduleResolution if not specified, meaning that projects that want to use bundler still need to keep that in their tsconfig to prevent errors & warnings such as:

Warn: Option 'moduleResolution=node10' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.

This came up in a project of mine when upgrading to TS6 and removing the explicit "moduleResolution": "bundler" from my config, and then running svelte-check (which uses the language-server).

Proposed solution

Is there an option to have the language server use whatever is the default moduleResolution based on the tsconfig and whatever version of Typescript is being used, so that we:
a) don't need to explicitly set bundler when its already the default, and
b) language-server doesn't try to use the deprecated resolution node10 in TS 6.0+ projects?

Alternatives

No response

Additional Information, eg. Screenshots

No response

Activity

  1. jasonlyu123 commented on Oct 19, 2026

    @jasonlyu123
    Member

    The node10 default is there for historical reasons. Changing it now does seem like a breaking change. So not sure if we can change it now. Having an option not to default to node10 seems a bit weird. If it's editor config, it won't work on svelte-check. You'll need to set the config explicitly anyway.

  2. dummdidumm commented on Oct 19, 2026

    @dummdidumm
    Member

    When we support TS7 we should change that (a lot of things likely work differently there anyway), but agree that we shouldn't/don't need to change it for 6+

  3. xyrolle commented on Oct 22, 2026

    @xyrolle

    I checked what the node10 default does in practice, with svelte-check 4.7.7. It isn't only the warning: svelte-check resolves differently from tsc.

    TypeScript 6.0.3, tsconfig with no module/moduleResolution (so tsc uses bundler), and import { sub } from "pkg/sub" where pkg only has exports:

    • tsc: 0 errors.
    • svelte-check (default mode): 4 errors and 1 warning. That's TS2307 for pkg/sub in the .ts and the .svelte file, TS2307 inside Svelte's own types for esrap and esrap/languages/ts (no skipLibCheck), and the node10 deprecation warning.
    • svelte-check --incremental (which runs TypeScript 6.0.3's tsc) and svelte-check --tsgo (TypeScript 7.0.2 via @typescript/native): 0 errors.

    With TypeScript 5.9.3, module: "nodenext" and no moduleResolution: tsc 0 errors; svelte-check 2 × TS2307, plus a warning that moduleResolution must be NodeNext. module: "preserve": tsc 0; svelte-check the same 2 × TS2307, with no warning.

    I also tried deriving the default through TypeScript's helper. It fixes this reproduction, but stress testing exposed conditional-export and mixed import/require cases that need more work, so I wouldn't propose the three-line change as ready:

    • With module: "commonjs", the language server later switches module to ESNext, so a package's import condition wins over require.
    • The module loader's resolution cache doesn't key on import vs require.

    Given those compatibility concerns, keeping explicit moduleResolution until the TS 7 work seems reasonable. Is this reproduction useful for that work?

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