GithubHelp home page GithubHelp logo

Comments (3)

huntie avatar huntie commented on May 2, 2024 1

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.

jbroma avatar jbroma commented on May 2, 2024 1

@huntie all tasks from the issue handled in the PRs above.

from metro.

jbroma avatar jbroma commented on May 2, 2024

Few other insights about Package Exports implementation & tests:

  1. 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
  2. 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.