V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
liuzhaowei55
V2EX  ›  Next.js

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

  •  
  •   liuzhaowei55 ·
    ysbjlzlx · May 4, 2023 via iPhone · 1790 views
    This topic created in 1099 days ago, the information mentioned may be changed or developed.
    react scripts 很久没有更新了,react 新文档也推荐使用 nextjs ,准备从 cra 迁移到 nextjs ,大家有使用 next export 的吗,有没有什么坑
    heishu
        1
    heishu  
       May 4, 2023
    也许有吧,比如 cra 肯定是 client 端渲染,但是 next 还有服务端渲染,有些三方库在 next 就会报错 window 为空,就需要 next 只在 client 端执行代码
    liuzhaowei55
        2
    liuzhaowei55  
    OP
       Jun 12, 2023 via iPhone
    @heishu 最近把一个 cra 项目迁移到了 nextjs 的 export 模式,好处暂时还没感受到,坑着实遇到了几个。
    window 为空的问题需要把组件用 dynamic 包起来,ace quill jsoneditor 都有这个问题,还有一些 hydrate render 等等问题待慢慢解决
    总结就是跟着潮流走,折腾一下
    liuzhaowei55
        3
    liuzhaowei55  
    OP
       Aug 31, 2023 via Android
    不使用 nextjs 的 ssr 着实没有使用 nextjs 的必要,然后控件库的引入对 ssr 支持也十分差劲,最终换为 vite
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5857 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 02:43 · PVG 10:43 · LAX 19:43 · JFK 22:43
    ♥ Do have faith in what you're doing.