I can't read a pdf in production mode Next

Viewed 40

I have a problem in my next js project when I do the "yarn build" and then "yarn start" and I try to read a pdf that was before doing the "build" and the "start" if I can see it in my browser by putting the path where I put it but if I already did the "build" and "start" and I add a pdf file manually to my next project in this case to the public folder and I try to access it from my browser by putting the path where I am sure it is it sent me a 404 error

I hope you can help me

enter image description here

If I can access the sample.pdf but the other pdf I can access

enter image description here

I hope you can help me thank you very much

1 Answers

When you run yarn build/npm run build/pnpm run build, NextJS copies everything from your public folder and puts it in the .next folder along with the transpiled javascript. If you want to add something to the public folder after you build it, you need to put it where the other pdfs are in the .next folder (probably in some subdirectory)

Related