perf(dts): switch plugin-dts to multi-entry build#1547
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8e8ea75e82
ℹ️ 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".
There was a problem hiding this comment.
Pull request overview
This PR updates the rsbuild-plugin-dts package build to use an explicit multi-entry setup (runtime index + dts worker entry) instead of emitting the entire source tree, and enables declaration extension redirection for the package build to better match emitted JS formats.
Changes:
- Switch package build output from bundleless “emit all src” to a multi-entry build (
index+dtsentries). - Enable
redirect.dts.extensionfor the package build so generated declaration imports use the correct emitted extension by default. - Simplify prebundle/external configuration by only prebundling
tsconfig-pathsand bundling previously prebundled runtime utilities.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/plugin-dts/tsconfig.json | Removes the magic-string path alias, aligning TS path overrides with the reduced prebundle set. |
| packages/plugin-dts/src/utils.ts | Refactors tsconfig-paths imports and lazily loads @ast-grep/napi to reduce startup cost. |
| packages/plugin-dts/src/index.ts | Updates worker path resolution to use import.meta.filename/dirname for locating the dts entry at runtime. |
| packages/plugin-dts/src/dts.ts | Extracts options type for calcBundledPackages to clarify the signature without behavior changes. |
| packages/plugin-dts/rslib.config.ts | Converts to explicit index + dts entries and enables redirect.dts.extension for the package build. |
| packages/plugin-dts/prebundle.config.mjs | Drops tinyglobby/magic-string from prebundle dependencies, keeping only tsconfig-paths. |
Summary
Change
rsbuild-plugin-dtsfrom a bundleless build to a multi-entry build, with explicitindexanddtsruntime entries instead of emitting the whole source tree as-is.Enable declaration extension redirection by default for the package build so generated dts files automatically use the correct extension for the emitted format.
Remove cjs-module-lexer calls.
Before
Now
Related Links
N/A
Checklist