如何解决服务器中的 ERROR [BABEL] 最大大小 500KB 问题?

Sya*_* KK 9 vue.js bootstrap-vue nuxtjs

我正在将 NUXTJS 应用程序用于 SSR 页面,但出现 bootstrap-vue 图标大小问题的错误。

该文件托管在 AWS 服务器中,这将是错误

The code generator has deoptimised the styling of 
/var/www/html/my_folder/node_modules/bootstrap-vue/src/icons/icons.js
as it exceeds the max of 500KB.
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

这将是什么问题?我也在构建位置添加了 babbel ..

小智 8

尝试添加

babel: { compact: true }

下面extend(config, ctx) {},像这样

....
 /*
 ** You can extend webpack config here
 */
 extend(config, ctx) {},
 babel: { compact: true }
Run Code Online (Sandbox Code Playgroud)

参考:https : //github.com/bootstrap-vue/bootstrap-vue/issues/5627#issuecomment-668487772

编辑:在 nuxt.config.js 文件上编辑


小智 7

你可以像这样添加它并且它可以工作,只需添加到你的 nuxt.config.js 文件中

  build: {
     babel: {
      compact: true,
     },
  },
Run Code Online (Sandbox Code Playgroud)