Reproduction link or steps
https://github.com/nyan-left/rolldown-browser-repro
CI failure: https://github.com/nyan-left/rolldown-browser-repro/actions/runs/23632405151/job/68834536336
Install @rolldown/browser in a TypeScript project with moduleResolution: "bundler" and run tsc --noEmit. The repro has the minimal setup and a CI workflow that shows the failure.
What is expected?
@rolldown/browser type declarations work with moduleResolution: "bundler" - same as the main rolldown package.
What is actually happening?
9 TS2307 errors. The .d.mts files in @rolldown/browser reference binding.cjs as an external module, but no corresponding type declaration file exists in the published package.
Cannot find module '../binding.cjs' or its corresponding type declarations.
Cannot find module '../../binding.cjs' or its corresponding type declarations.
Cannot find module './binding.cjs' or its corresponding type declarations.
The main rolldown package doesn't have this issue because its DTS output bundles the binding types inline into dist/shared/binding-[hash].d.mts. The browser package doesn't because resolveWasiBinding() in build.ts marks binding.cjs as external: 'relative' for all importers - including the .d.ts files generated by rolldown-plugin-dts. The dts resolver sees external: true and passes it through without bundling the types.
System Info
TypeScript: 5.9.3
@rolldown/browser: 1.0.0-rc.12
@types/node: 24.10.3
Node: 22
pnpm: 9
Any additional comments?
Here is a proposed solution: #8930
Reproduction link or steps
https://github.com/nyan-left/rolldown-browser-repro
CI failure: https://github.com/nyan-left/rolldown-browser-repro/actions/runs/23632405151/job/68834536336
Install
@rolldown/browserin a TypeScript project withmoduleResolution: "bundler"and runtsc --noEmit. The repro has the minimal setup and a CI workflow that shows the failure.What is expected?
@rolldown/browsertype declarations work withmoduleResolution: "bundler"- same as the mainrolldownpackage.What is actually happening?
9 TS2307 errors. The
.d.mtsfiles in@rolldown/browserreferencebinding.cjsas an external module, but no corresponding type declaration file exists in the published package.The main
rolldownpackage doesn't have this issue because its DTS output bundles the binding types inline intodist/shared/binding-[hash].d.mts. The browser package doesn't becauseresolveWasiBinding()inbuild.tsmarksbinding.cjsasexternal: 'relative'for all importers - including the.d.tsfiles generated byrolldown-plugin-dts. The dts resolver seesexternal: trueand passes it through without bundling the types.System Info
Any additional comments?
Here is a proposed solution: #8930