DEV Community

Mitch
Mitch

Posted on

Next.JS 14.0.3 build error

Have anyone encounter build error with Next.JS 14.0.2 or 14.0.3??

I've been using 13.4 and then 14.0.1 for testing a CMS with dynamic routes.

Build & deploy is all ok.

However upgrading to 14.0.2 or 14.0.3 will throw error during build. It'll throw error about pre-rendering error on every dynamic route pages.

Been searching for answer for so long, turns out it's related to route segment config. The workaround is adding this to layout / page / route

export const dynamic = 'force-dynamic'

However, doing this will force the page to be re-rendered at every request.

Leave a comment if you encounter this and what's your workaround?

Top comments (0)