Next.JS 使用 babel 来配置Why Did You Render。
module.exports = function (api) {
const isServer = api.caller((caller) => caller?.isServer)
const isCallerDevelopment = api.caller((caller) => caller?.isDev)
const presets = [
[
'next/babel',
{
'preset-react': {
importSource:
!isServer && isCallerDevelopment
? '@welldone-software/why-did-you-render'
: 'react'
}
}
]
]
return {presets}
}
如何在不禁用 SWC 的情况下将其更新到 Next.JS 12?