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

Package exports: resolve to real paths, fix module duplication in output #1198

Closed
wants to merge 1 commit into from

Conversation

robhogan
Copy link
Contributor

Summary:
Fix: #1197

unstable_enablePackageExports and unstable_enableSymlinks in combination may result in non-real module paths in the graph, because PackageExportsResolve only uses context.doesFileExist and does not necessarily return real paths.

Often, especially with pnpm, this results in a module appearing multiple times under different paths in the output bundle, as if duplicated on the file system, which causes incorrect behaviour for stateful modules and increases bundle size.

The fix mirrors the implementation of resolveSourceFileForExt in the non-exports resolver.

Changelog:

 - **[Experimental]:** Fix module duplication due to non-real resolved paths when combining `unstable_enablePackageExports` and `unstable_enableSymlinks`.

Differential Revision: D52964393

Summary:
Fix: facebook#1197

`unstable_enablePackageExports` and `unstable_enableSymlinks` in combination may result in non-real module paths in the graph, because `PackageExportsResolve` only uses `context.doesFileExist` and does not necessarily return real paths.

Often, especially with pnpm, this results in a module appearing multiple times under different paths in the output bundle, as if duplicated on the file system, which causes incorrect behaviour for stateful modules and increases bundle size.

The fix mirrors the implementation of `resolveSourceFileForExt` in the non-exports resolver.

Changelog:
```
 - **[Experimental]:** Fix module duplication due to non-real resolved paths when combining `unstable_enablePackageExports` and `unstable_enableSymlinks`.
```

Differential Revision: D52964393
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 22, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D52964393

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 98b05c2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[0.80.4] Metro bundle duplicated code when use unstable_enablePackageExports and unstable_enableSymlinks
2 participants