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

Initial resolveDir is invalid when using Yarn Berry, paths in metafile.json are invalid too #627

Closed
remorses opened this issue Dec 28, 2020 · 2 comments · Fixed by #628
Closed

Comments

@remorses
Copy link
Contributor

remorses commented Dec 28, 2020

When using yarn berry the initial resolveDir passed to plugins is invalid, for example /usr/morse/github/github becomes /usr/morse/github/github

The paths in metafile.json are invalid too, they have one more ../ than necessary, for example what should be ./index.ts becomes ../index.ts, this is probably because esbuild thinks cwd is /usr/morse/github/github instead of /usr/morse/github

This does not happen when using yarn 1, only with yarn berry

Reproduction:
https://github.com/remorses/esbuild-reproduction-wrong-resolveDir-in-yarn-berry

@remorses
Copy link
Contributor Author

The problem is in the realpath function, it repeats the basename

func realpath(path string) string {

@evanw
Copy link
Owner

evanw commented Dec 29, 2020

I did some investigation. This appears to be because in this specific case the path ends with /. When that happens filepath.Dir(path) ends with filepath.Base(path) instead of excluding it. I was unfortunately unable to construct an automated test of this scenario.

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 a pull request may close this issue.

2 participants