【发布时间】:2022-06-20 07:18:26
【问题描述】:
我正在尝试更新此 Next JS Starter https://github.com/timlrx/tailwind-nextjs-starter-blog 中的依赖项
将 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
但升级后出现问题,只有 preact 保持不变
要复制,只需克隆 repo 并将 react 和 react-dom 版本更改为 18.0.0
在导航时构建您的网站后,您会看到问题
【问题讨论】: