Comments (3)
Thanks @jbroma!
1. Root Array Shorthand
Wow, essentially these implementations have a special-case expansion of ["./index.js"]
to {".": "./index.js"}
— happy to align ✅.
2. Subpath Patterns in exports
Yup, also looks incorrect ✅. I don't think we have a test against that behaviour at all.
IMO, these test cases should be marked as [nonstrict] as they rely on fallback mechanism:
- should resolve "exports" target directly > without expanding sourceExts
- should resolve "exports" target directly > without expanding platform-specific extensions
These tests are for in-spec behaviour, so I think this is right as-is. However, the assertions seem slightly wrong (unless I'm misremembering) — they should be index-exports.js
. This test needs a little fixing.
Yes please to PRs! 🙌🏻 Recommend splitting into one PR per fix, and we'll happily look through :).
from metro.
@huntie all tasks from the issue handled in the PRs above.
from metro.
Few other insights about Package Exports implementation & tests:
-
When multiple entires in root array shorthand are defined the resolvers behave in a following way:
- node: looks for first valid specifier (beginning with
./
), and returns it, even when it's non-existent - enhanced-resolve: similar to node, but looks for first valid entry that actually exists
- metro-resolver: can't tell because case from the issue fails
- node: looks for first valid specifier (beginning with
-
IMO, these test cases should be marked as
[nonstrict]
as they rely on fallback mechanism:
- should resolve "exports" target directly > without expanding
sourceExts
- should resolve "exports" target directly > without expanding platform-specific extensions
FYI, im willing to submit a PR for this after we agree on the spec.
from metro.
Related Issues (20)
- [0.73.x] Metro crashes because of `__loadBundleAsync` HOT 6
- Unable to resolve module stream HOT 4
- [0.80.4] Metro bundle duplicated code when use unstable_enablePackageExports and unstable_enableSymlinks HOT 3
- No matching version found for [email protected] HOT 1
- Unable to resolve module when using symlinks. HOT 6
- error Cannot read properties of undefined (reading 'transformFile'). TypeError: Cannot read properties of undefined (reading 'transformFile') HOT 2
- Metro uses watchman that leaks watched files HOT 2
- Default metro resolver slower than MetroSymlinksResolver in a monorepo HOT 3
- React Native application does not update on many code changes when using vim HOT 4
- esm HOT 1
- Performance regression between 0.73.9 and 0.76.8 HOT 4
- Unable to resolve self-referring "subpath exports" from within a haste module HOT 1
- `nodeModulesPaths` not working as expected with React Native HOT 1
- Cannot read property 'transformFile' of undefined HOT 1
- Including local packages from outside project root. Can we do better?
- [BUG] Terser mangler issue after upgrading to RN 0.74.5
- Problem during ReactNative project deployment for iOS HOT 2
- Add types for `require.context` HOT 1
- Slow bundle download(~2 mins) in dev mode by ReloadCommand(r) on iOS after RN 72 upgrade HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metro.