Skip to content

fix: resolve ~137 DTS warnings in vp pack when importing UserConfig#993

Merged
fengmk2 merged 18 commits intovoidzero-dev:mainfrom
kazupon:fix/991
Mar 19, 2026
Merged

fix: resolve ~137 DTS warnings in vp pack when importing UserConfig#993
fengmk2 merged 18 commits intovoidzero-dev:mainfrom
kazupon:fix/991

Conversation

@kazupon
Copy link
Collaborator

@kazupon kazupon commented Mar 17, 2026

Fixes #991

Changes

packages/cli/src/pack-bin.ts

  • Add rolldown transform plugin (vite-plus:external-dts-type-only) that converts import/export to import type/export type in postcss and lightningcss .d.ts files at bundle time
  • Also transforms import * as PostCSS from "postcss" to import type in @voidzero-dev/vite-plus-core .d.ts files to prevent IMPORT_IS_UNDEFINED warnings

packages/test/build.ts

  • Fix vitest/browser path mapping from index.js to context.js to match vitest's own package.json exports, resolving CDPSession missing export
  • Extend patchModuleAugmentations() to merge augmented type definitions (e.g. ExpectPollOptions) into target .d.ts files, since rolldown cannot resolve cross-file declare module augmentations
  • Add BrowserCommands re-export to context.d.ts

Testing

  • Run vp pack in kazupon/vp-config and verify zero MISSING_EXPORT / IMPORT_IS_UNDEFINED warnings

@netlify
Copy link

netlify bot commented Mar 17, 2026

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit 65bcba0
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/69bb900e9e08330008722945

@fengmk2
Copy link
Member

fengmk2 commented Mar 17, 2026

Could you refer to https://github.com/voidzero-dev/vite-plus/blob/main/.claude/skills/add-ecosystem-ci/SKILL.md or the current snap tests code and add a corresponding e2e test case or snap test case to ensure this fix remains effective going forward?

@fengmk2 fengmk2 self-assigned this Mar 17, 2026
@fengmk2 fengmk2 requested review from Brooooooklyn and fengmk2 March 17, 2026 11:18
@kazupon
Copy link
Collaborator Author

kazupon commented Mar 18, 2026

I've already added snapshot test case and more improvement fixes.

@fengmk2
Copy link
Member

fengmk2 commented Mar 18, 2026

@Boshen Let's invite @kazupon to join the core contributors 🥇

@fengmk2
Copy link
Member

fengmk2 commented Mar 19, 2026

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5f142fa5ef

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@fengmk2 fengmk2 merged commit ae51ac5 into voidzero-dev:main Mar 19, 2026
44 checks passed
@fengmk2
Copy link
Member

fengmk2 commented Mar 19, 2026

@kazupon Thanks for helping to deal with this complex issue. 👍

TheAlexLichter pushed a commit that referenced this pull request Mar 19, 2026
…993)

Fixes #991

## Changes

### `packages/cli/src/pack-bin.ts`
- Add rolldown transform plugin (`vite-plus:external-dts-type-only`)
that converts `import`/`export` to `import type`/`export type` in
postcss and lightningcss `.d.ts` files at bundle time
- Also transforms `import * as PostCSS from "postcss"` to `import type`
in `@voidzero-dev/vite-plus-core` `.d.ts` files to prevent
`IMPORT_IS_UNDEFINED` warnings

### `packages/test/build.ts`
- Fix `vitest/browser` path mapping from `index.js` to `context.js` to
match vitest's own `package.json` exports, resolving `CDPSession`
missing export
- Extend `patchModuleAugmentations()` to merge augmented type
definitions (e.g. `ExpectPollOptions`) into target `.d.ts` files, since
rolldown cannot resolve cross-file `declare module` augmentations
- Add `BrowserCommands` re-export to `context.d.ts`

## Testing

- Run `vp pack` in
[kazupon/vp-config](https://github.com/kazupon/vp-config) and verify
zero `MISSING_EXPORT` / `IMPORT_IS_UNDEFINED` warnings

---------

Co-authored-by: MK (fengmk2) <fengmk2@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vp pack emits ~137 d.ts warnings when library imports UserConfig from vite-plus

2 participants