-
Notifications
You must be signed in to change notification settings - Fork 26.2k
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: only copy in-project symlinks #66785
Conversation
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
@ijjk Gentle ping. Could you please take a look? |
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.
Hi, this doesn't seem correct as it is valid to have a relative symlink like with pnpm
's node_module's handling which we want to handle. Instead we should be only copying the file if it is outside of the detected project root.
If we aren't copying when we detect outside of the project root could we add a test case and ensure the above described behavior is occurring?
Could you point to where I should add the test?
In a mono-repo, this will fail because pnpm will link outside the package root. |
@jun-sheaf is attempting to deploy a commit to the Vercel Partnerships Team on Vercel. A member of the Team first needs to authorize it. |
6dd5090
to
ebea1a9
Compare
It looks like there are bigger problems than just the symlinks when trying to build this through Bazel. More specifically, because the For Bazel users, the solution we used was to wrap the CLI and run |
What?
Instead of copying symlinks in
standalone
builds, we resolve them to their realpath and copy the actual file.Why?
By their nature, symlinks are not meant for standalone builds. If they resolve to a path somewhere else, that path needs to exist at runtime which may not be the case. E.g. we use Bazel where node_module dependencies are sandboxed and symlinked during build. This implies Next.js will copy over these symlinks built for the sandbox which will break once the sandbox is destroyed.
How?
Instead of using
reallink
, we userealpath
.