if you have a custom server, enabling the experimental public folder with { experimental: { publicDirectory: true } } will try to serve from ./dist/public, but this folder does not exists in dev. also next build does not copy it over.
Steps to reproduce the behavior, please provide code snippets or a repository:
{ experimental: { publicDirectory: true } }i am unsure how this is meant to work in the default case. I solved it by adding an additional script in package.json that copies /public over to dist (something like "rimraf ./dist/public && cp -r ./public ./dist")
https://nextjs.org/docs#custom-server-and-routing should probably mention that
OS: macOS
Version of Next.js: [e.g. 9.0.2]
@macrozone I'm unable to reproduce the issue, the public folder was working fine in my environment, feel free to re-open the issue and share a demo if the issue persists
for reference:
I had a project which was based on an older typescript&customserver config where everything was built to /dist (incl. next), so only /dist would be deployed to the production environment. In this scenario, public and static folder would not automatically appear in /dist of course.
i now aligned this setup to be like in https://github.com/zeit/next.js/tree/canary/examples/custom-server-typescript
Most helpful comment
for reference:
I had a project which was based on an older typescript&customserver config where everything was built to /dist (incl. next), so only /dist would be deployed to the production environment. In this scenario, public and static folder would not automatically appear in /dist of course.
i now aligned this setup to be like in https://github.com/zeit/next.js/tree/canary/examples/custom-server-typescript