-
Notifications
You must be signed in to change notification settings - Fork 93
Description
Our next.js site has some symlinks in the public/
directory to files outside the public directory. (These files come from a git submodule which is why they aren't in the public directory directly.) The file layout looks like
next-config.js
package.json
pages/...
thesubrepo/screenshots/aaa.png
thesubrepo/screenshots/bbb.png
public/somedirectfile
public/screenshots (screenshots is a symlink to "../thesubrepo/screenshots")
The pages then reference /screenshots/aaa.png
which works great during development. The issue is during deployment the copyPublicFiles function https://github.com/netlify/netlify-plugin-nextjs/blob/main/src/lib/steps/copyPublicFiles.js does not dereference the symlink so what happens is that in the netlify publish path there is a symlink screenshots
to a directory that does not exist.
The copySync
function https://github.com/jprichardson/node-fs-extra/blob/HEAD/docs/copy-sync.md has an option dereference
but it defaults false.
Maybe it would be a backwards compatibility problem to just always set dereference
to true, but could there be an option or config setting somewhere to enable dereferencing public files when copying them to the publish directory? Maybe an environment variable? Just need to pass dereference: true
to copySync
.
For now, I have worked around this by manually copying the files as an additional build step.