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

fix(externals): absolute paths are inlined #1429

Merged
merged 8 commits into from
Aug 6, 2023
Merged

fix(externals): absolute paths are inlined #1429

merged 8 commits into from
Aug 6, 2023

Conversation

pi0
Copy link
Member

@pi0 pi0 commented Jul 14, 2023

πŸ”— Linked issue

❓ 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

Discovered while trying to make reproduction tests for #527.

Normally importing a library with a subpath like @fixture/nitro-utils/extra correctly creates an externals chunk in .output/server/node_modules/@fixture/nitro-utils/extra.mjs. But we wrongly inline if this path is absolute for any reason (like using aliases).

This PR fixes this by using a default scoring assigned to include/exclude patterns based on their length (function patterns have highest priority always). When an inline rule conflicts with an external, it will be only applied if is more precise and also by adding all node_modules as externals by default.

πŸ“ Checklist

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

@danielroe
Copy link
Member

Let's merge and test for a while - like you, I think this could be risky.

@pi0 pi0 marked this pull request as ready for review August 6, 2023 21:09
@pi0 pi0 merged commit ab57c75 into main Aug 6, 2023
5 checks passed
@pi0 pi0 deleted the fix/external-inline branch August 6, 2023 21:12
@pi0 pi0 mentioned this pull request Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants