The dts bundler emits plain import { ... } and export { ... } for symbols that the source declared as type-only, instead of import type { ... } / export { type ... }.
Reproduced on rolldown-plugin-dts@0.24.0-beta.1 with rolldown@1.0.0-rc.17.
Under rolldown 1.0.0-rc.17, this becomes a hard build failure when the imported names are not value exports of the importee — rolldown rc.17 promoted MISSING_EXPORT between TS modules from a warning to an error in rolldown#9197 (commit cc38b86). Builds that previously emitted this as silenced warnings now abort with errors like:
[MISSING_EXPORT] Error: "Foo" is not exported by "node_modules/some-pkg/index.d.ts".
Minimal reproduction
package.json:
{"type":"module","devDependencies":{"rolldown":"1.0.0-rc.17","rolldown-plugin-dts":"0.24.0-beta.1","typescript":"6.0.3"}}
rolldown.config.ts:
import {defineConfig} from "rolldown";
import {dts} from "rolldown-plugin-dts";
export default defineConfig({
input: "src/index.ts",
external: ["pkg"],
plugins: [dts()],
});
src/index.ts:
declare module "pkg" {
export const value: number;
export type T = string;
}
import {value} from "pkg";
import type {T} from "pkg";
export const x = value;
export type Y = T;
Run:
pnpm install
pnpm exec rolldown -c
Actual output (dist/index.d.ts)
import { T } from "pkg"; // T is type-only — no `type` modifier
declare module "pkg" {
const value: number;
type T = string;
}
declare const x: any;
type Y = T;
export { Y, x }; // Y is a type — no `type` modifier
Expected output
import type { T } from "pkg";
declare module "pkg" {
const value: number;
type T = string;
}
declare const x: any;
type Y = T;
export { type Y, x };
Real-world impact
In a real project with verbatimModuleSyntax: true and an external module that uses export = X (e.g. dayjs — Dayjs, ConfigType, OpUnitType, OptionType only exist via the namespace), the missing type modifier turns those names into invalid value imports. With rolldown rc.17 the build fails with multiple MISSING_EXPORT errors aggregated from the dts bundling step.
Versions
rolldown-plugin-dts: 0.24.0-beta.1 (also reproduces on 0.23.2)
rolldown: 1.0.0-rc.17
typescript: 6.0.3
Related
This issue was written with the help of Claude Opus 4.7
The dts bundler emits plain
import { ... }andexport { ... }for symbols that the source declared as type-only, instead ofimport type { ... }/export { type ... }.Reproduced on
rolldown-plugin-dts@0.24.0-beta.1withrolldown@1.0.0-rc.17.Under rolldown 1.0.0-rc.17, this becomes a hard build failure when the imported names are not value exports of the importee — rolldown rc.17 promoted
MISSING_EXPORTbetween TS modules from a warning to an error in rolldown#9197 (commit cc38b86). Builds that previously emitted this as silenced warnings now abort with errors like:Minimal reproduction
package.json:{"type":"module","devDependencies":{"rolldown":"1.0.0-rc.17","rolldown-plugin-dts":"0.24.0-beta.1","typescript":"6.0.3"}}rolldown.config.ts:src/index.ts:Run:
pnpm install pnpm exec rolldown -cActual output (
dist/index.d.ts)Expected output
Real-world impact
In a real project with
verbatimModuleSyntax: trueand an external module that usesexport = X(e.g.dayjs—Dayjs,ConfigType,OpUnitType,OptionTypeonly exist via the namespace), the missingtypemodifier turns those names into invalid value imports. With rolldown rc.17 the build fails with multipleMISSING_EXPORTerrors aggregated from the dts bundling step.Versions
Related
export *losestypemodifiers when flattening re-exports #95 — same shape (typemodifier dropped) but forexport *re-exportsThis issue was written with the help of Claude Opus 4.7