我正在尝试更新这个 Next JS Starter 中的依赖项https://github.com/timlrx/tailwind-nextjs-starter-blog。
在将 react 和 react-dom 升级到 18.0.0 后,在开发中一切正常。
但是在生产环境中,当尝试导航到其他页面时,新页面没有被渲染,并且此错误被记录在控制台中。
在将 react 和 react-dom 升级到 18.0.0 后,在开发中一切正常。
但是在生产环境中,当尝试导航到其他页面时,新页面没有被渲染,并且此错误被记录在控制台中。
TypeError: (0 , h.default.startTransition) is not a function
at h.default.createElement.callbacks (main-8f675a98ab9e3b2e.js:1:16469)
at fe (main-8f675a98ab9e3b2e.js:1:16546)
at main-8f675a98ab9e3b2e.js:1:11506
at l (main-8f675a98ab9e3b2e.js:1:93120)
at Generator._invoke (main-8f675a98ab9e3b2e.js:1:92908)
at Generator.S.forEach.e.<computed> [as next] (main-8f675a98ab9e3b2e.js:1:93543)
at M (main-8f675a98ab9e3b2e.js:1:6457)
at i (main-8f675a98ab9e3b2e.js:1:6660)
at main-8f675a98ab9e3b2e.js:1:6719
at new Promise (<anonymous>)
A client-side exception has occurred, see here for more info: https://nextjs.org/docs/messages/client-side-exception-occurred
Uncaught (in promise) Error: Cancel rendering route
at Y (main-8f675a98ab9e3b2e.js:1:14883)
at main-8f675a98ab9e3b2e.js:1:14823
at new Promise (<anonymous>)
at fe (main-8f675a98ab9e3b2e.js:1:14793)
at main-8f675a98ab9e3b2e.js:1:12790
Uncaught (in promise) TypeError: (0 , h.default.startTransition) is not a function
at h.default.createElement.callbacks (main-8f675a98ab9e3b2e.js:1:16469)
at fe (main-8f675a98ab9e3b2e.js:1:16546)
at main-8f675a98ab9e3b2e.js:1:12790
在生产环境中,他们从React切换到Preact https://github.com/timlrx/tailwind-nextjs-starter-blog/blob/41839607af9db071eadb60fa9fc4ffb4942661cf/next.config.js#L75toL83
但是在升级React后出现了问题,只有Preact保持不变
要重现问题,只需克隆repo并将React和React-DOM版本更改为18.0.0
构建网站后导航时,您将看到该问题