在前端项目执行 npm run build 构建时,Babel 报错信息:
[BABEL] Note: The code generator has deoptimised the styling of xxxxxxx/typescript.js as it exceeds the max of 500KB.
解决办法
在项目根目录下新建.babelrc 添加下面的内容
{
"compact": false
}
Babel 配置compact 的作用
在Babel配置中,compact选项的作用是控制生成的代码是否进行压缩和优化。当compact设置为false时,Babel会生成更紧凑、优化的代码,这有助于减少代码体积,提高运行效率。然而,这种优化可能会导致调试变得更加困难,因为优化后的代码可能难以追踪和调试。