Exclude file pattern in public
from being copied during export
#72239
eliot-akira
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Allow users to exclude certain files/folders in
public
from being copied during exportBackground
In one project I have a symbolic link in the
public
directory, which links to a huge folder of files external to the project. I'd like to exclude these files from getting copied during export, so I can just link to the same external folder for the production site.I tracked down where this copying is happening, in
packages/next/src/export/index.ts
.I tried to use the existing filter
exportPathMap
as a workaround by creating a dummy page, but couldn't get it to exclude that folder.Proposal
This could be an option, like
excludeExportFromPublicDir
, that accepts a string, regular expression pattern, or function that returns boolean. Then in the above code section, thefilter
option forrecursiveCopy
can apply this additional user-provided filter.Alternative solution
In the meantime I was able to solve my use case with a custom server that serves files from a symlinked folder outside of
public
, under a URL route of the same name. When deploying the exported static site to production, I exclude the folder on the target server where an equivalent symlink exists.Beta Was this translation helpful? Give feedback.
All reactions