Minimal reproduction of a vp pack failure where a type-only import
(import type { Request } from 'express') is emitted into the generated
.d.ts without the type modifier, so rolldown's declaration bundler
treats it as a value import and fails:
[MISSING_EXPORT] "Request" is not exported by "node_modules/.pnpm/@types+express@4.17.23/node_modules/@types/express/index.d.ts".
Request is a type-only export of @types/express, so there is no value
binding to resolve. The source already uses import type, so the tool's own
suggested fix ("add the type modifier") does not apply — the type modifier
is lost somewhere in the declaration emit/bundle step.
| Package | Version |
|---|---|
vite-plus |
0.2.1 (@voidzero-dev/vite-plus-core@0.2.1) |
typescript |
5.9.3 |
@types/express |
4.17.23 |
@types/node |
22.x |
| node | v22.21.1 |
| pnpm | 10.28.0 |
pnpm install
pnpm build # => vp packExpected: a clean build with a bundled dist/index.d.mts.
Actual: build fails. The first (and root) error is:
ℹ Build start
error: Build failed with 8 errors:
[MISSING_EXPORT] "Request" is not exported by "node_modules/.pnpm/@types+express@4.17.23/node_modules/@types/express/index.d.ts".
╭─[ src/index.d.ts:1:10 ]
│
1 │ import { Request } from 'express';
│ ───┬───
│ ╰───── Missing export
│
│ Note: If you meant to import a type rather than a value, make sure to add the `type` modifier (e.g. `import { type Foo } from 'express'`).
───╯
Note the generated src/index.d.ts:1 reads import { Request } from 'express';
even though the input (src/index.ts:1) is import type { Request } from 'express';.
The remaining 7 errors are the same class of failure cascading through the
transitive @types/express graph (connect, send, qs, range-parser,
express-serve-static-core), each a type-only import emitted without type.
src/index.ts:
import type { Request } from 'express';
export function validateRequest(req: Request): boolean {
return Boolean(req.url);
}The failure is in the declaration generation/bundle path, not in JS bundling:
pack.dts setting |
Result |
|---|---|
dts: { build: true } |
FAILS (MISSING_EXPORT) |
dts: true |
FAILS (MISSING_EXPORT) |
dts: false |
Builds successfully (JS only, no .d.ts) |
So any configuration that emits declarations reproduces the bug; disabling dts
avoids it. Removing the express type import (or not referencing Request in
an exported signature) also avoids it.
vite.config.ts is set to dts: { build: true } to match the original report;
flip it to dts: false to confirm the JS build itself is fine.