Skip to content

Fix infinite loop in resolver when using ~/... imports#1881

Merged
fathyb merged 3 commits into
masterfrom
fix/infinite-resolver-loop
Aug 17, 2018
Merged

Fix infinite loop in resolver when using ~/... imports#1881
fathyb merged 3 commits into
masterfrom
fix/infinite-resolver-loop

Conversation

@DeMoorJasper

@DeMoorJasper DeMoorJasper commented Aug 10, 2018

Copy link
Copy Markdown
Member

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
Comment thread src/Resolver.js Outdated
) {
dir = path.dirname(dir);

if (dir === '/') {

Copy link
Copy Markdown
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))?

@DeMoorJasper DeMoorJasper Aug 16, 2018

Copy link
Copy Markdown
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
Copy Markdown
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.

2 participants