facebook / metro

🚇 The JavaScript bundler for React Native
https://metrobundler.dev
MIT License
5.24k stars 626 forks source link

[0.80.11] breaks package exports with symlinks #1347

Closed franksmule closed 2 months ago

franksmule commented 2 months ago

Hello, having an issue with 0.80.11 and pnpm + expo + symlinks + package exports

In 0.80.10 package exports are resolved correctly. In 0.80.11 package exports are not resolved.

I have created a reproduction of this issue here: https://github.com/franksmule/expo-repo/tree/main

Symlinks are enabled, although I've enabled shamefully-hoist=true - I believe local packages are still symlinked - so it seems to be an issue with the combination of symlinks and package exports?

Metro Config: (https://github.com/franksmule/expo-repo/blob/main/expo-app/metro.config.js)

config.resolver.unstable_enablePackageExports = true;
config.resolver.unstable_enableSymlinks = true;
iOS Bundling failed 756ms index.js (1013 modules)
Unable to resolve "@internal/another-dep/hi" from "app/(tabs)/index.tsx"

Reproduction: https://github.com/franksmule/expo-repo - change https://github.com/franksmule/expo-repo/blob/main/package.json#L5 - to 0.80.10 and notice bundle will load.

robhogan commented 2 months ago

Huge thanks for the report @franksmule - confirmed this is a bug with the new TreeFS.hierarchicalLookup and I can repro in a unit test (f409bde4).

Working on it...

robhogan commented 2 months ago

Should be fixed in v0.80.12