V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
liuzhaowei55
V2EX  ›  Next.js

next export 相比较 cra 静态输出有什么坑吗?

  •  
  •   liuzhaowei55 ·
    ysbjlzlx · 363 天前 via iPhone · 978 次点击
    这是一个创建于 363 天前的主题,其中的信息可能已经有所发展或是发生改变。
    react scripts 很久没有更新了,react 新文档也推荐使用 nextjs ,准备从 cra 迁移到 nextjs ,大家有使用 next export 的吗,有没有什么坑
    heishu
        1
    heishu  
       363 天前
    也许有吧,比如 cra 肯定是 client 端渲染,但是 next 还有服务端渲染,有些三方库在 next 就会报错 window 为空,就需要 next 只在 client 端执行代码
    liuzhaowei55
        2
    liuzhaowei55  
    OP
       324 天前 via iPhone
    @heishu 最近把一个 cra 项目迁移到了 nextjs 的 export 模式,好处暂时还没感受到,坑着实遇到了几个。
    window 为空的问题需要把组件用 dynamic 包起来,ace quill jsoneditor 都有这个问题,还有一些 hydrate render 等等问题待慢慢解决
    总结就是跟着潮流走,折腾一下
    liuzhaowei55
        3
    liuzhaowei55  
    OP
       244 天前 via Android
    不使用 nextjs 的 ssr 着实没有使用 nextjs 的必要,然后控件库的引入对 ssr 支持也十分差劲,最终换为 vite
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   780 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 21:48 · PVG 05:48 · LAX 14:48 · JFK 17:48
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.