Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(third-party-dts-extractor): correctly sets the source of the pack… #3467

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tamasangyan
Copy link

Description

Issue:
The third-party-extractor package currently resolves the package folder based on the location of the entry file, which can lead to incorrect handling of type declarations. Specifically, when a package has its entry file in a subdirectory (e.g., ./lib/) with a nested package.json, the extractor incorrectly identifies this subdirectory as the package root. This becomes problematic if the type declarations are located in a different directory (e.g., ./types/) as specified in the root package.json's types attribute. As a result, the type declarations are not copied correctly, leading to potential issues in type resolution.

Solution:
This PR modifies the third-party-extractor to prioritize the root package.json's types attribute when determining the location of type declarations. If the root package.json explicitly specifies a types directory, the extractor will now copy the type declarations from the correct location, regardless of where the entry file is located. This ensures that type declarations are accurately resolved and included, aligning with the package's intended structure.

Impact:
This change improves the reliability of type declaration handling for packages with nested entry points and separate type directories, ensuring that the correct types are always included in the extracted output.

Related Issue

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated the documentation.

Copy link

changeset-bot bot commented Jan 29, 2025

🦋 Changeset detected

Latest commit: e74c1e8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 29 packages
Name Type
@module-federation/third-party-dts-extractor Patch
@module-federation/dts-plugin Patch
@module-federation/enhanced Patch
@module-federation/manifest Patch
@module-federation/rspack Patch
@module-federation/modern-js Patch
@module-federation/nextjs-mf Patch
@module-federation/node Patch
@module-federation/rsbuild-plugin Patch
@module-federation/storybook-addon Patch
@module-federation/modernjsapp Patch
@module-federation/runtime Patch
@module-federation/webpack-bundler-runtime Patch
@module-federation/sdk Patch
@module-federation/runtime-tools Patch
@module-federation/managers Patch
@module-federation/devtools Patch
@module-federation/bridge-react Patch
@module-federation/bridge-vue3 Patch
@module-federation/bridge-shared Patch
@module-federation/bridge-react-webpack-plugin Patch
@module-federation/retry-plugin Patch
@module-federation/data-prefetch Patch
@module-federation/error-codes Patch
@module-federation/inject-external-runtime-core-plugin Patch
@module-federation/esbuild Patch
@module-federation/runtime-core Patch
@module-federation/utilities Patch
website-new Patch

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

Copy link

netlify bot commented Jan 29, 2025

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit e74c1e8
🔍 Latest deploy log https://app.netlify.com/sites/module-federation-docs/deploys/679aab171843e90008d84612
😎 Deploy Preview https://deploy-preview-3467--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

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.

1 participant