next.js when load /static/ files like images got 404 return in production
how to resolve it ?
Please Provide a minimal example of how to reproduce.
I'm seeing this same problem. Been trying to debug why it's happening. Will keep trying and see if I can get a minimum reproduction. Funnily enough I have the same code running with it working and a fresh checkout causes this to happen - very confusing.
Same thing is happening to me. next build is not copying the static directory from my project root into the dist folder. I bumped my version to 5.0.1-canary.5, but still not working for me. I added a build step where I manually copy the static directory to remedy the issue in the meantime.
How did you guys resolve this? I'm getting the same 404 when in development for image files only, but displaying the static image is working in development.
I've tried adding the following code to my server to no avail:
server.use('/static', express.static(path.join(__dirname, '/../static')));
I'm on the latest canary.16.