fix(dts): preserve inferred roots and diagnostics - #4947
Conversation
🦋 Changeset detectedLatest commit: b4ff38f The changes in this PR will be included in the next version bump. This PR includes changesets to release 47 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@module-federation/devtools
@module-federation/cli
create-module-federation
@module-federation/dts-plugin
@module-federation/enhanced
@module-federation/error-codes
@module-federation/esbuild
@module-federation/managers
@module-federation/manifest
@module-federation/metro
@module-federation/metro-plugin-rnc-cli
@module-federation/metro-plugin-rnef
@module-federation/metro-plugin-rock
@module-federation/modern-js
@module-federation/modern-js-v3
@module-federation/native-federation-tests
@module-federation/native-federation-typescript
@module-federation/nextjs-mf
@module-federation/node
@module-federation/observability-plugin
@module-federation/playground
@module-federation/retry-plugin
@module-federation/rsbuild-plugin
@module-federation/rspack
@module-federation/rspress-plugin
@module-federation/runtime
@module-federation/runtime-core
@module-federation/runtime-tools
@module-federation/sdk
@module-federation/storybook-addon
@module-federation/third-party-dts-extractor
@module-federation/treeshake-frontend
@module-federation/treeshake-server
@module-federation/typescript
@module-federation/utilities
@module-federation/webpack-bundler-runtime
@module-federation/bridge-react
@module-federation/bridge-react-webpack-plugin
@module-federation/bridge-shared
@module-federation/bridge-vue3
@module-federation/inject-external-runtime-core-plugin
commit: |
|
🚀 Preview Environment Ready!
Details:
|
Bundle Size Report7 package(s) changed, 35 unchanged. Package dist + ESM entry
Bundle targets
Consumer scenarios
Total dist (raw): 35.80 MB (+6.6 kB (+0.0%)) Bundle sizes are generated with rslib (Rspack). Package-root metrics preserve the historical report. Tracked subpath exports such as |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09c3807d17
ℹ️ 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".
|
If this PR is intended to fix type generation for files outside the project directory, it should also consider cross-workspace dependencies. For example, an exposed file under apps/remote may import source code from a sibling workspace package such as packages/shared. The root directory should Could we add a regression test for this case before merging? |
Summary
Fix DTS temporary-project root inference and retain actionable TypeScript failure artifacts.
Root cause
When
compilerOptions.rootDirwas omitted, the DTS plugin inferred a root from the source tsconfig but did not include exposed workspace files outside that tsconfig'sincludeset. The TypeScript 7--listFilesOnlytemporary config was also written undernode_modules/.federationwithout the computed root, so TypeScript could infer the temporary directory as its source root and emit TS6059. When dependency scanning or declaration generation failed, temporary configs were deleted or the fatal compiler output was reduced to insufficient context.Changes
rootDirunchanged.rootDirinto temporary dependency-scan configs..mf/diagnostics/dts/list-files/.mf/diagnostics/dts/generate-types/include, dependency traversal, diagnostic persistence, and temp-config cleanup.Validation
pnpm install --frozen-lockfile --ignore-scriptspnpm exec rstest run src/core/configurations/remotePlugin.test.ts src/core/lib/typeScriptCompiler.test.ts --passWithNoTests— 64 tests passedpnpm --filter @module-federation/dts-plugin run lintpnpm exec turbo run build --filter=@module-federation/dts-plugin --force— 7 tasks passedpnpm exec turbo run test --filter=@module-federation/dts-plugin --force— 15 files / 176 tests passedpnpm exec prettier --check .pnpm exec changeset statusNotes
The build continues to print existing dependency declaration warnings from webpack/tapable/fast-uri; they are unchanged and do not fail the build.
Closes #4948