You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
input: fix(zip-it-and-ship-it): create missing symlinks when archiveFormat=none
This change updates zisi's node bundler to create missing symlinks in
when `archiveFormat: 'none'` (the code path used by `netlify dev`).
Currently, in projects where two or more symlinks resolve to the same
target, we only ever create one symlink. In practice, how this usually
presents a problem is when a package manager dedupes a dependency by
symlinking it into two different packages; users end up getting a
runtime error when their code hits the code path that tries to resolve
the missing symlink.
For example, given this scenario (which I took from a project that
exhibits this issue):
```
{
targetPath: '../../../@netlify[email protected]/node_modules/@netlify/sdk--extension-api-client',
absoluteDestPath: '/home/ndhoule/dev/src/github.com/netlify/integration-csp/.netlify/functions-serve/trpc/node_modules/.pnpm/@netlify[email protected]_@[email protected]/node_modules/@netlify/sdk--extension-api-client'
}
{
targetPath: '../../../@netlify[email protected]/node_modules/@netlify/sdk--extension-api-client',
absoluteDestPath: '/home/ndhoule/dev/src/github.com/netlify/integration-csp/.netlify/functions-serve/trpc/node_modules/.pnpm/@netlify[email protected]_@[email protected]_@[email protected]_@[email protected]._vp3jgimrs3u5kdeagmtefgn5zi/node_modules/@netlify/sdk--extension-api-client'
}
```
...only the second symlink is created. This is because as we walk
through the list of files to output to the build directory, we only
track a single symlink destination per target. Many symlinks can point
at the same target, though, so we need to track multiple symlink
destinations per target.
I tested this out in my problem projects and it solved the problem. I
took a stab at adding a test for this, but got a little lost in the test
setup, which seems to have the `.zip` code path in mind rather than the
`'none'` path. Happy to write some tests if someone can point me at a
test setup.
0 commit comments