Next.js Discord

Discord Forum

next.js build error

Answered
Shing posted this in #help-forum
Open in Discord
Avatar
I created a component to put random audio and I want each time the page is reloaded, there is a different audio. The fact is that seeing it from the development environment (npm run dev) it works fine, but when I build it (npm run build && npm run start), it is no longer dynamic, that is, the audio no longer changes every time you reload the website.
Image
Answered by Ray
export const dynamic = 'force-dynamic'
View full answer

5 Replies

Avatar
sound like the page is static generated
you could try to set the page to dynamic
Avatar
export const dynamic = 'force-dynamic'
Answer
Avatar
That's it, thank you very much.