-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Resolve realpath #5183
Resolve realpath #5183
Conversation
Co-authored-by: Amin Yahyaabadi <[email protected]>
Co-authored-by: Amin Yahyaabadi <[email protected]>
Co-authored-by: Amin Yahyaabadi <[email protected]>
|
Wow! This is awesome. Excited to see this in action. Should we revive the pnpm PR as well after this is merged? |
Please do, I have been tracking this issue for that very reason. |
I have tested pnpm with this pr, it works fine and no more duplicate depenndency. |
I want to request the maintainers to review this if they can and let us know if there is anything we can do to get this through. I'm afraid that other pull requests introduce conflicts with this, like how it happened for the old PR. 😄 cc: @mischnic @DeMoorJasper @devongovett etc |
Co-authored-by: Amin Yahyaabadi <[email protected]>
Anything else remaining here? What's the procedure for merging something into Parcel? It's a little unclear how the PRs work in Parcel considering that this (or its related PR) has been open for a couple of months now. |
@devongovett please consider accepting this PR. It or it's predecessor have been around for 5 months and dishuostec got it mergeable twice. |
I merged V2 into this branch and ran the tests. Everything works without any issues. I only had to increase this time out to parcel/packages/core/core/test/AssetGraphBuilder.test.js Lines 10 to 12 in a4cf3e9
|
@DeMoorJasper Why is bundle undefined in parcel-benchmark-action? This seems strange. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I apologize for the slow response to this PR. I am also making some changes to the resolver in #5481, so I will update this and make a new PR with those changes merged in. Thanks again for your contribution!
filePath: realModuleDir | ||
? path.join(realModuleDir, subPath || '') | ||
: path.join(dir, 'node_modules', filename), | ||
isSymlink: realModuleDir ? realModuleDir !== moduleDir : false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty sure this will always be true. The FS module returns the original path if there is no realpath https://github.com/parcel-bundler/parcel/blob/v2/packages/core/fs/src/NodeFS.js#L82
@@ -429,11 +430,16 @@ export default class NodeResolver { | |||
let moduleDir = path.join(dir, 'node_modules', moduleName); | |||
let stats = await this.fs.stat(moduleDir); | |||
if (stats.isDirectory()) { | |||
const realModuleDir = await this.fs.realpath(moduleDir); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is slightly different from what Node does. This only considers symlinked directories whereas node also supports symlinked files. I believe Node basically just takes the realpath at the end after everything has been resolved. This would also avoid the need for the isSymlink
flag because the symlink path would be used until the very end of the algorithm.
See #5508 |
Origin pull request #4939
I fixed all test #4939 (comment)