Fix glob resolver package issue with deep entry points #8169
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
↪️ Pull Request
This is a follow-up from #8097 - when trying to implement the change in my repository I realised there was a step missed, if the package entry point resolves to a file not in the root, then the paths for the glob import will need to be relative to the entry point, where they should be able to be relative to the package root.
This change adds an additional step to perform a
findPackage
on the resultingfilePath
in order to resolve to the root of the package.💻 Examples
Before if you had a package
@scope/pkg
with an entry point of./dist/index.js
then the glob resolver would resolve the root to@scope/pkg/dist/
, so if you used a path like@scope/pkg/src/foo*.js
it would actually resolve to@scope/pkg/dist/src/foo*.js
which is incorrect. With this change the path resolves as expected.🚨 Test instructions
Failing integration test with a deep entry point was added, change was made and confirmed all integration tests still pass.
✔️ PR Todo
unitintegration tests for this change