Skip to content

Guide vp pack projects off @typescript/native-preview with vp migrate #3526

Description

@fengmk2

Some projects use TypeScript 5 or 6 for type checking and @typescript/native-preview to emit declarations with vp pack. Starting with [email protected], the upstream tsgo generator expects TypeScript 7.1+ for its new API. Vite+ PR #3511 keeps these projects building with a temporary rolldown-plugin-dts patch and an optional core peer dependency. #3342 tracks the dependency upgrade. This issue tracks the migration for existing projects.

Have the regular vp migrate upgrade flow identify packages that explicitly use tsgo with @typescript/native-preview. Explain the two upstream options and let the project choose before changing its compiler. Projects can upgrade typescript to 7.1+ (the upstream example uses [email protected]) or point pack.dts.tsgo.moduleUrl at a separately installed compatible compiler. For dynamic configs and custom tsgo.path values, report which config needs review. Check other uses of the preview package before suggesting its removal. tsdown migration notes · Plugin migration examples

Verify the separate-compiler option in a pnpm workspace with hoist: false. A direct typescript-next alias emitted declarations successfully in both TypeScript 5.9 and 6.0 projects, but pnpm also selected its tsc binary for existing scripts. Check both the declarations from vp pack and the version that the project’s existing tsc command runs.

Document how projects that upgrade without running vp migrate can transition. Once that path is covered, remove the declaration-plugin patch and the optional @typescript/native-preview peer from core.

Activity

  1. self-assigned this
    on Nov 21, 2026
  2. voidzero-bot commented on Nov 21, 2026

    @voidzero-bot
    Contributor
    • Reproduced: Skipped — feature request, not a bug report (nothing incorrect happens on current main; the requested vp migrate guidance simply doesn't exist yet)
    • Exploration: Yes
    • Unit Test: No — triage only ran the reproduce stage; no fix was produced, so no test was added
    • Priority: Priority P1: chore. Nothing is broken on current main: the tsgo + native-preview declaration flow still builds (bundled tsdown is pinned to 0.23.4, and PR feat(deps): upgrade to Vite 8.4 beta, Rolldown 1.3, and tsdown 0.23.7 #3511's temporary patch that this issue eventually retires isn't even merged yet), so this is planned migration-guidance and cleanup work rather than a user-facing defect.

    This issue asks for new detection and guidance in vp migrate for projects that emit vp pack declarations with the tsgo generator and @typescript/native-preview. I confirmed on the current checkout (b6da1ac3) that this flow is absent: packages/cli/src/migration/migrator/ contains no handling for tsgo, dts, or @typescript/native-preview, and running vp migrate --no-interactive on a matching project (TypeScript 5.9.3 + @typescript/native-preview 7.0.0-dev + pack.dts = { generator: 'tsgo' }, pnpm hoist: false) exits 0 with only "This project is already using Vite+! Happy coding!". The eventual breakage this issue preempts — tsdown 0.23.5+ requiring TypeScript 7.1+ for the tsgo generator — also cannot be triggered on main, since main still pins tsdown: =0.23.4 / rolldown-plugin-dts: ^0.28.0; PR #3511 (commit 3c9999cf, which adds patches/[email protected]) sits on an unmerged branch.

    I wasn't able to find a fix, but I identified some areas that may be relevant. A future implementation would add a detection/guidance rule under packages/cli/src/migration/migrator/ (likely alongside vite-config.ts/package-json.ts, where the static pack.dts config and the @typescript/native-preview dependency would be inspected), record the rule in docs/guide/migrate-rules.md (which already documents the dts.tsgo / dts.oxc → dts.generator rule at line 62), and extend the existing snapshot fixture crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/command_pack_dts_compat (case command_pack_dts_native_preview), which already models the exact project shape this issue targets. The patch/peer removal tracked here is gated on PR #3511 and the tsdown 0.23.5 upgrade (#3342) landing first — this is a starting point for a human, not a diagnosis.

    Full Triage Report

    Triage Report — Issue #3526

    Issue summary

    Title: Guide vp pack projects off @typescript/native-preview with vp migrate

    Classification: Feature (enhancement to the vp migrate upgrade flow)

    The issue asks that the regular vp migrate upgrade flow identify packages that explicitly use tsgo via @typescript/native-preview, explain the two upstream options (upgrade typescript to 7.1+, or point pack.dts.tsgo.moduleUrl at a separately installed compatible compiler), report dynamic configs / custom tsgo.path values that need review, and check other uses of the preview package before suggesting removal. Follow-up items include verifying the separate-compiler option in a pnpm workspace with hoist: false, documenting the transition for projects that upgrade without running vp migrate, and then removing the temporary rolldown-plugin-dts patch and the optional @typescript/native-preview peer from core.

    Expected behavior (requested): vp migrate on a project that uses TypeScript 5.x/6.x plus @typescript/native-preview for vp pack declarations detects that setup and guides the project through the compiler transition.

    Actual behavior (current checkout): vp migrate completes without detecting or mentioning tsgo / @typescript/native-preview at all.

    Environment

    Component Version
    Vite+ (checkout, main) v1.7.0 (b6da1ac3)
    Bundled tools vite 8.3.8, rolldown 1.2.19, tsdown 0.23.4, tsrs 7.1.0-beta.tsrs4
    Node.js v24.22.3
    pnpm v12.11.2 (CLI); fixture used pnpm 11.24.0
    OS Ubuntu x64 (GitHub runner)
    Repro project typescript 5.9.3, @typescript/native-preview 7.0.0-dev.20260707.2, pnpm workspace with hoist: false

    Repository state relevant to the report

    • Current main pins tsdown: =0.23.4 and rolldown-plugin-dts: ^0.28.0 (pnpm-workspace.yaml); the bundled rolldown-plugin-dts is 0.28.8 (packages/core/dist/tsdown/tsc-DHauxsFv.js). The tsgo API change that requires TypeScript 7.1+ ships in tsdown 0.23.5, which main has not upgraded to yet (tracked by Upgrade tsdown and its extensions to 0.23.5 #3342).
    • PR feat(deps): upgrade to Vite 8.4 beta, Rolldown 1.3, and tsdown 0.23.7 #3511 (commit 3c9999cf, "fix(pack): keep native-preview declaration builds working with tsdown", plus 62daa758/cf7746c8) exists on an unmerged branch — it is not an ancestor of main. It adds patches/[email protected], bumps the declaration plugin, and keeps native-preview builds working after the tsdown 0.23.5 upgrade. packages/core/package.json on main already declares the optional @typescript/native-preview peer (from older commit 36406f74).
    • The migrator (packages/cli/src/migration/migrator/) contains no handling for tsgo, dts, or @typescript/native-preview — no detection rule, no guidance, nothing.

    Reproduction path

    Created the smallest project matching the report, modeled on the existing snapshot fixture command_pack_dts_compat (which already covers "explicit tsgo generator + native-preview + TypeScript 5.9.3 + pnpm hoist: false"):

    1. Copied the fixture into /tmp/vite-plus-triage/gh-3526/repro (removed snapshot files), set devDependencies to [email protected] + @typescript/[email protected] + vite-plus, and set pack.dts = { generator: 'tsgo' } in vite.config.ts.

    2. node $VITE_PLUS_REPO/packages/tools/src/local-npm-registry.ts --pack -- vp install --ignore-scripts → exit 0; installed @typescript/native-preview 7.0.0-dev.20260707.2, typescript 5.9.3, vite-plus 1.7.0 (packed from the checkout).

    3. Control case: vp pack → exit 0.

      ℹ Build start
      warn: TypeScript 7.0 does not yet have a stable API and is experimental. Some options will be unavailable.
      ℹ Emit types with @typescript/[email protected]
      ℹ dist/index.mjs    0.19 kB │ gzip: 0.14 kB
      ℹ dist/index.d.mts  0.09 kB │ gzip: 0.09 kB
      ✔ Build complete in 81ms
      

      dist/index.d.mts was emitted correctly. The reported breakage (tsgo generator requiring TypeScript 7.1+) does not occur on current main because main still bundles tsdown 0.23.4 / rolldown-plugin-dts 0.28.x, and PR feat(deps): upgrade to Vite 8.4 beta, Rolldown 1.3, and tsdown 0.23.7 #3511's patch is not merged here.

    4. Reported trigger: vp migrate --no-interactive (run against the checkout via the local npm registry; first run hit an unrelated local-registry port mismatch in the lockfile — a test-harness artifact, resolved by serving the registry persistently) → exit 0:

      This project is already using Vite+! Happy coding!
      

      No identification of the tsgo/@typescript/native-preview setup, no explanation of the two compiler options, no review notes for the static config — the migration flow this issue requests does not exist yet.

    Result

    Not reproduced / skipped — feature request, not a bug report.

    • No incorrect behavior occurs on the current checkout: the tsgo + native-preview + TypeScript 5.9.3 project builds and packs successfully, and vp migrate exits 0. The reported tsdown 0.23.5 tsgo API requirement is not present on main (tsdown pinned to 0.23.4; PR feat(deps): upgrade to Vite 8.4 beta, Rolldown 1.3, and tsdown 0.23.7 #3511 unmerged), so the upcoming breakage cannot be triggered here.
    • What was demonstrated instead is the absence of the requested functionality: vp migrate performs no tsgo/@typescript/native-preview detection or guidance, confirmed both by running it on a matching project and by source inspection of packages/cli/src/migration/migrator/.

    Classification: Feature — new detection/guidance functionality in the vp migrate upgrade flow (with documentation and core cleanup as follow-up work items inside the same issue).

    Observations useful for diagnosis (no fix proposed)

    • The existing snapshot fixture crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/command_pack_dts_compat (case command_pack_dts_native_preview) already models the exact project shape this issue targets (explicit dts.generator: 'tsgo', TypeScript 5.9.3, @typescript/native-preview, pnpm hoist: false, local registry) and its snapshot at main shows a successful pack. PR feat(deps): upgrade to Vite 8.4 beta, Rolldown 1.3, and tsdown 0.23.7 #3511's branch updates the same snapshots after the plugin bump — a natural place to add migrate-flow coverage.
    • The issue's pnpm hazard (a direct typescript-next alias also supplying the tsc binary selected for existing scripts under hoist: false) is part of the requested verification work, not an observable defect on current main; nothing on main yet suggests or installs the alias.
    • docs/guide/migrate-rules.md:62 already documents a dts.tsgo / dts.oxc migration rule (select with dts.generator), which shows where a future tsgo-compiler rule would be recorded.
    • Removal of the rolldown-plugin-dts patch and the optional @typescript/native-preview peer depends on PR feat(deps): upgrade to Vite 8.4 beta, Rolldown 1.3, and tsdown 0.23.7 #3511 landing first; on main the peer is declared optional since 36406f74 (fix(core): declare optional peers of bundled rolldown-plugin-dts #2868), independent of the patch.

    This report was made by an LLM. The analysis may be wrong, and the potential fix might not work, but is intended as a starting point for exploring the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Fields

Priority

None yet

Start date

None yet

Target date

None yet

Effort

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions