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
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -38,7 +38,7 @@
"dotenv": "^5.0.0",
"fast-glob": "^2.2.2",
"filesize": "^3.6.0",
"fswatcher-child": "^1.0.3",
"fswatcher-child": "^1.0.5",
"get-port": "^3.2.0",
"grapheme-breaker": "^0.3.2",
"htmlnano": "^0.1.9",
Expand Down
5 changes: 5 additions & 0 deletions src/Resolver.js
Expand Up @@ -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?

dir = this.options.rootDir;
break;
}
}

return path.join(dir, filename.slice(1));
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Expand Up @@ -2679,9 +2679,9 @@ fstream@^1.0.0, fstream@^1.0.2:
mkdirp ">=0.5 0"
rimraf "2"

fswatcher-child@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/fswatcher-child/-/fswatcher-child-1.0.3.tgz#c89076126a3004909f6f68c0ea5c9d9143b237fd"
fswatcher-child@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/fswatcher-child/-/fswatcher-child-1.0.5.tgz#134d012ffa74918975617e00e56e4139f36cb140"
dependencies:
chokidar "^2.0.3"

Expand Down