简体   繁体   中英

Why does react number format input field lose focus in nextjs on production build

Why some of the input fields in our nextjs project rendered using react-number-format lose focus while typing? No errors are being thrown and the build logs does not indicate that something has been broken.

This happens only on production build.

nextjs version is 12.0.7

react-number-format version is 4.8.0

Answering my own question in case someone come across the same issue:

After following nextjs upgrade guide from v11 to v12 we replaced Terser with SWC for minifying and after changing it back to Terser the issue was resolved.

in next.config.js file:

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

This was also mentioned here as part of the nextjs feedback thread about SWC.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM