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 infinite loop in resolver when using ~/... imports #1881

Merged
merged 3 commits into from Aug 17, 2018

Conversation

DeMoorJasper
Copy link
Member

@DeMoorJasper DeMoorJasper commented Aug 10, 2018

If ~ is being used outside of rootDir and node_modules, the resolver will freeze on an infinite loop.

This PR changes it to fallback to rootDir, as that's probably the intended behaviour.

SideNote: FSWatcher Update just forces parcel to use 1.0.5, which fixes an issue with profiler

@DeMoorJasper DeMoorJasper changed the title Fix infinite loop in resolver if using ~ Fix infinite loop in resolver when using ~ Aug 10, 2018
@DeMoorJasper DeMoorJasper changed the title Fix infinite loop in resolver when using ~ Fix infinite loop in resolver when using ~/... imports Aug 12, 2018
src/Resolver.js Outdated
@@ -132,6 +132,11 @@ class Resolver {
path.basename(path.dirname(dir)) !== 'node_modules'
) {
dir = path.dirname(dir);

if (dir === '/') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this work on Windows? What about if (dir === path.dirname(dir))?

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably a better idea. I'll update it.

Sidenote the resolver is already broken on windows.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, do you know if we're tracking this somewhere?

@fathyb fathyb merged commit a330668 into master Aug 17, 2018
@fathyb fathyb deleted the fix/infinite-resolver-loop branch August 17, 2018 04:21
devongovett pushed a commit that referenced this pull request Oct 15, 2018
* fix infinite loop in resolver

* if ~ require is outside rootDir and node_modules, fallback to rootDir

* more reliable root check
devongovett pushed a commit that referenced this pull request Oct 15, 2018
* fix infinite loop in resolver

* if ~ require is outside rootDir and node_modules, fallback to rootDir

* more reliable root check
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.

None yet

2 participants