Skip to content

fix(externals)!: fall back to mlly resolver in more cases #431

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

Merged
merged 2 commits into from
Sep 1, 2022

Conversation

danielroe
Copy link
Member

πŸ”— Linked issue

context: nuxt/nuxt#14629

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

In the linked issue above, the presence of a directory express was skipping the mlly resolution process as the path existed. I've added a couple of additional conditions here:

  1. resolve with mlly if id is not absolute (express.js) won't map to ~/express.js in node terms
  2. resolve with mlly if id is a directory - as directory imports won't work in esm and we need to resolve /index.js
  3. only call normalizeid on absolute paths as otherwise (if mlly absolutely can't resolve it) we can end up with something like file://express

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@danielroe danielroe added the bug Something isn't working label Aug 22, 2022
@danielroe danielroe requested a review from pi0 August 22, 2022 11:28
@danielroe danielroe self-assigned this Aug 22, 2022
@codecov
Copy link

codecov bot commented Aug 22, 2022

Codecov Report

Merging #431 (ed112e5) into main (d0029c0) will decrease coverage by 0.01%.
The diff coverage is 33.33%.

@@            Coverage Diff             @@
##             main     nuxt/nuxt.js#11753      +/-   ##
==========================================
- Coverage   53.54%   53.53%   -0.02%     
==========================================
  Files          54       54              
  Lines        3565     3566       +1     
  Branches      377      378       +1     
==========================================
  Hits         1909     1909              
  Misses       1293     1293              
- Partials      363      364       +1     
Impacted Files Coverage Ξ”
src/rollup/plugins/externals.ts 63.82% <33.33%> (-0.27%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@pi0
Copy link
Member

pi0 commented Aug 22, 2022

Would you please provide a (nitro) reproduction? πŸ™πŸΌ

@danielroe
Copy link
Member Author

I believe the fix makes sense on its own for the reasons mentioned in the description.

But here you go: https://stackblitz.com/edit/nuxt-starter-qlsvtz.

@danielroe danielroe requested a review from pi0 August 30, 2022 21:57
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM to include in next semver-major since this change is risky somehow.

For next PRs, please use a minimal nitro reproduction to help me review faster πŸ™πŸΌ

@pi0 pi0 changed the title fix: fall back to mlly resolver in more cases fix(externals)!: fall back to mlly resolver in more cases Sep 1, 2022
@pi0 pi0 merged commit 2fbf234 into main Sep 1, 2022
@pi0 pi0 deleted the fix/resolve-more-paths branch September 1, 2022 10:35
WinterYukky pushed a commit to WinterYukky/nitro that referenced this pull request Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants