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

handle require.resolve fallback when walking node_modules with no main field in package.json #733

Merged
merged 5 commits into from
Sep 22, 2021

Conversation

thescientist13
Copy link
Member

@thescientist13 thescientist13 commented Sep 20, 2021

Related Issue

resolves #557 (comment)

Summary of Changes

  1. Add fallback handling when require.resolve can find what we need

TODOs

  1. Understand why it cant be found
    • seems related to how NodeJS treats packages with "unusable" main field in its package.json (see edit to above linked comment)
    • this is kind of "disappointing" because while these packages may not have a "main" or exports, in the case of @babel/runtime, they still have their own dependencies, so we still need to get the location to walk that package.json
  2. Add test cases
  3. How to best fallback in the above identified situation? Maybe as part of leverage import.meta.resolve to support import maps generation and accurate node_modules resolution when building #684 or keep leverage NodeJS resolve logic for looking up location of paths for node modules #557 open and move into the next project?

@thescientist13 thescientist13 added bug Something isn't working P0 Critical issue that should get addressed ASAP CLI labels Sep 20, 2021
@thescientist13 thescientist13 added this to the 1.0 milestone Sep 20, 2021
@thescientist13 thescientist13 self-assigned this Sep 20, 2021
@thescientist13 thescientist13 changed the title handle require.resolve fallback when walking node_modules handle require.resolve fallback when walking node_modules with no main field in _package.json_ Sep 21, 2021
@thescientist13 thescientist13 added the discussion tied to an ongoing discussion or meeting notes label Sep 21, 2021
@thescientist13 thescientist13 marked this pull request as ready for review September 21, 2021 18:31
@thescientist13 thescientist13 changed the title handle require.resolve fallback when walking node_modules with no main field in _package.json_ handle require.resolve fallback when walking node_modules with no main field in package.json Sep 21, 2021
@thescientist13 thescientist13 removed the discussion tied to an ongoing discussion or meeting notes label Sep 22, 2021
@thescientist13 thescientist13 merged commit cb9d5a9 into master Sep 22, 2021
@thescientist13 thescientist13 deleted the bug/issue-557-handle-require-resolve-fallback branch September 22, 2021 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CLI P0 Critical issue that should get addressed ASAP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

leverage NodeJS resolve logic for looking up location of paths for node modules
1 participant