【问题标题】:Why does react number format input field lose focus in nextjs on production build为什么反应数字格式输入字段在 nextjs 中失去对生产构建的关注
【发布时间】:2022-01-04 07:29:44
【问题描述】:

为什么在我们的nextjs 项目中使用react-number-format 呈现的某些输入字段在键入时失去焦点?没有抛出任何错误,构建日志也没有表明有什么东西被破坏了。

在生产版本中发生。

nextjs 版本为 12.0.7

react-number-format 版本为 4.8.0

【问题讨论】:

    标签: reactjs next.js production-environment react-number-format


    【解决方案1】:

    如果有人遇到同样的问题,请回答我自己的问题:

    在关注 nextjs upgrade guide 从 v11 到 v12 我们 replaced Terser with SWC for minifying 并将其改回 Terser 后问题得到解决。

    next.config.js 文件中:

    module.exports = withTM({
    swcMinify: false,
    ...
    })
    

    这在nextjs 关于 SWC 的反馈线程中也提到了 here

    【讨论】:

      猜你喜欢
      • 2021-08-02
      • 2018-10-25
      • 2014-09-17
      • 1970-01-01
      • 2021-01-29
      • 2021-09-29
      • 2013-12-17
      • 2019-04-02
      • 1970-01-01
      相关资源
      最近更新 更多