Skip to content

sv migrate sveltekit-3: tsconfig with "module": "nodenext" loses $app/env/* types #17350

Closed

Description

@hyunbinseo

Describe the bug

In SvelteKit 3, $app/tsconfig sets module: "esnext" / moduleResolution: "bundler". With "module": "nodenext", $app/types/env.d.ts (declares $app/env/public and $app/env/private) is no longer picked up unless it is in include.

The tsconfig task of sv migrate sveltekit-3 keeps nodenext (it differs from the inherited default) but doesn't add the file to include.

Reproduction

  1. sv create blank --template minimal --types ts
  2. Set compilerOptions.module and moduleResolution to "nodenext" in tsconfig.json.
  3. Add import { PUBLIC_FOO } from '$app/env/public'; to a .ts file.
  4. tsc --noEmit or svelte-check.
module include has node_modules/$app/types/env.d.ts $app/env/public
nodenext no TS2307: Cannot find module
nodenext yes resolves
default no resolves

$app/env (e.g. browser) resolves in all cases.

Expected

Either:

  • the migration adds node_modules/$app/types/env.d.ts to include when module is not esnext, or
  • $app/tsconfig/the docs state that nodenext users must add it.

Versions

  • sv 1.0.1
  • @sveltejs/kit 3.0.0
  • typescript 6.0.3

Activity

  1. transferred this issue fromsveltejs/clion Oct 5, 2026
  2. svelte-triage-bot commented on Oct 5, 2026

    @svelte-triage-bot
    Contributor

    I reproduced the issue, but could not produce a safe, verified fix.

    What I tried

    Why I stopped
    An existing open upstream PR already addresses this bug: #17351. Creating a competing fix would duplicate active maintainer work, so the task was stopped per the prior-art rule.

  3. added a commit that references this issue on Oct 5, 2026
    4902434
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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions