-
-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
⬆️ chore: upgrade nextjs to 14.0.2 #467
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
👍 @arvinxx Thank you for raising your pull request and contributing to our Community |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
❤️ Great PR @arvinxx ❤️ The growth of project is inseparable from user feedback and contribution, thanks for your contribution! |
被这个折腾了一天 🤧 |
I’ve been struggling with this for a whole day 🤧 |
🎉 This PR is included in version 0.101.5 🎉 The release is available on: Your semantic-release bot 📦🚀 |
* 🤖 chore(auto-submit): Add gen-z (lobehub#467) * 🤖 chore(auto-submit): Generate i18n for gen-z (lobehub#467)
💻 变更类型 | Change Type
🔀 变更说明 | Description of Change
升级 Nextjs 到 14.0.2,核心做了两部分变更:
📝 补充信息 | Additional Information
相关问题记录:
直接升级到 14.0.2 ,会报错:
export 'getHighlighterCore' (reexported as 'getHighlighterCore') was not found in './core.mjs' (module has no exports)
。之前没详细排查,临时锁到了14.0.1:📌 chore: lock nextjs to 14.0.1 to avoid build error #439经过排查后发现是 nextjs 不支持 mjs 的编译,refs: antfu/shikiji#23 。通过添加 webpack 构建脚本解决:
antd 本身存在 es 和 lib 两个文件夹,对应两份组件实例。14.0.0 ~ 14.0.1 会将 antd 引入实例错误地锁定为
lib
。(正常情况下应该是浏览器走 es,server 走 lib)。这个会导致 ssr 时cssinjs 库无法正确收集到样式缓存,进而造成 FOUC 问题(在 antd 社区中也被广泛讨论: ant-design/ant-design#45567 )antd 官方给出的解决方案是将 cssinjs 的引入改为 lib,即 从
import { ... } from "@ant-design/cssinjs"
改为import { ...} from '@ant-design/cssinjs/lib'
。而 LobeChat 中引入了 antd-style ,cssinjs 是被藏起来的。所以 @Asuka109 提供了 alias 的解决方案。而 14.0.2 版本的 nextjs 应该解决了上述问题,因此将该补丁移除。
我们在做 tts 时, 从
@lobehub/tts/react
引入 antd 组件会触发报错:此时如果打印一下这两个组件,会发现引入的不是标准的组件,而是一个 从 lib 转换为 es 模块的 object。
升级到 14.0.2 该问题就被解决了……