Skip to content

Cannot use in Vite 8 with tsgo: true without enforce: pre #201

@kube

Description

@kube

Reproduction link or steps

Here is a PR setting up rolldown-plugin-dts in one of our packages:

hashintel/hash#8509

Describe the bug

I understand that this is not meant to be used in Vite 8 yet, but wanted to give it a try.

The current setup working for me is to enforce: pre on the fake-js plugin:

dts({ tsgo: true }).map((plugin) =>
  // Ensure runs before Vite's native TypeScript transform
  plugin.name.endsWith("fake-js") ? { ...plugin, enforce: "pre" } : plugin,
)

Maybe this could be enforced somehow in the Rolldown plugin directly (I know the Plugin types are different between them, but would be convenient)


When using the plugin as is: (with tsgo)

dts({ tsgo: true })

I get this error:

transforming (1178) src/components/spreadsheet.tsx🐼 info [hrtime] Extracted in (126.93ms)
✓ 1185 modules transformed.
✗ Build failed in 5.97s
error during build:
Build failed with 1 error:

[MISSING_EXPORT] Error: "isSDCPNEqual" is not exported by "src/lib/deep-equal.d.ts".
   ╭─[ src/petrinaut.d.ts:3:10 ]
   │
 3 │ export { isSDCPNEqual } from "./lib/deep-equal";
   │          ──────┬─────  
   │                ╰─────── Missing export
───╯

    at aggregateBindingErrorsIntoJsError (file:///Users/HASH/Code/hash/cf-petrinaut-tsgo-dts/libs/@hashintel/petrinaut/node_modules/vite/node_modules/rolldown/dist/shared/error-BYPsvVEN.mjs:52:18)
    at unwrapBindingResult (file:///Users/HASH/Code/hash/cf-petrinaut-tsgo-dts/libs/@hashintel/petrinaut/node_modules/vite/node_modules/rolldown/dist/shared/error-BYPsvVEN.mjs:22:128)
    at #build (file:///Users/HASH/Code/hash/cf-petrinaut-tsgo-dts/libs/@hashintel/petrinaut/node_modules/vite/node_modules/rolldown/dist/shared/rolldown-build-BsRSEDqH.mjs:3356:34)
    at async buildEnvironment (file:///Users/HASH/Code/hash/cf-petrinaut-tsgo-dts/libs/@hashintel/petrinaut/node_modules/vite/dist/node/chunks/node.js:32703:64)
    at async Object.build (file:///Users/HASH/Code/hash/cf-petrinaut-tsgo-dts/libs/@hashintel/petrinaut/node_modules/vite/dist/node/chunks/node.js:33125:19)
    at async Object.buildApp (file:///Users/HASH/Code/hash/cf-petrinaut-tsgo-dts/libs/@hashintel/petrinaut/node_modules/vite/dist/node/chunks/node.js:33122:153)
    at async CAC.<anonymous> (file:///Users/HASH/Code/hash/cf-petrinaut-tsgo-dts/libs/@hashintel/petrinaut/node_modules/vite/dist/node/cli.js:642:3) {
  errors: [Getter/Setter]
}

System Info

System:
    OS: macOS 26.3
    CPU: (10) arm64 Apple M1 Max
    Memory: 1.79 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.21.1 - /Users/HASH/.local/share/mise/installs/node/22.21.1/bin/node
    Yarn: 4.12.0 - /Users/HASH/.local/share/mise/installs/node/22.21.1/bin/yarn
    npm: 10.9.4 - /Users/HASH/.local/share/mise/installs/node/22.21.1/bin/npm
  Browsers:
    Chrome: 145.0.7632.160
    Safari: 26.3

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Contributions

  • I am willing to submit a PR to fix this issue
  • I am willing to submit a PR with failing tests (actually just go ahead and do it, thanks!)

Compensating engineering work will speed up resolution and support the project

  • I'm willing to offer $16 for financial support

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions