next.js icon indicating copy to clipboard operation
next.js copied to clipboard

next.js when load /static/ files like images got 404 return in production

Open Deval520 opened this issue 8 years ago • 4 comments

how to resolve it ?

Deval520 avatar Jan 28 '18 07:01 Deval520

Please Provide a minimal example of how to reproduce.

timneutkens avatar Jan 28 '18 09:01 timneutkens

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.

robdmoore avatar Feb 14 '18 01:02 robdmoore

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.

mikemclin avatar Feb 15 '18 14:02 mikemclin

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.

bryan avatar Mar 16 '18 17:03 bryan