【问题标题】:Ember production build error 'WARN: Output exceeds 32000 characters'Ember 生产构建错误“警告:输出超过 32000 个字符”
【发布时间】:2017-03-03 11:27:34
【问题描述】:

我正在开发一个 Ember 应用程序,

在那个应用程序中-

为生产环境构建应用程序在构建过程中给出以下警告。

在执行ember build --environment=production 命令时

我收到以下警告:

WARN: Output exceeds 32000 characters

我们需要抑制或消除此警告。

【问题讨论】:

    标签: node.js ember.js npm ember-cli uglifyjs


    【解决方案1】:

    您需要在 options 对象中提及它以进行 minifyjs 配置,

    var app = new EmberApp(defaults, {
        minifyJS: {
          enabled: true, //by default its enabled for production
          options: {
            "max-line-len": 50000, //you can mention custom value
          }
        }    
      });
    

    【讨论】:

    • 这个答案很有帮助,只需注意将 max-line-len 放在双引号中,否则构建失败并出现意外令牌 -
    • 我只是不明白为什么这值得警告。我们有一个很小的网站,但我们收到了同样的警告。
    【解决方案2】:

    Kumkanillam 的回答对我不起作用(带有 UglifyJS 2.8.22 的 Ember CLI 2.12.2)。不过,它走在了正确的轨道上。经过一番挖掘,我想出了这个:

    var app = new EmberApp(defaults, {
      minifyJS: {
        enabled: true,
        options: {
          output: { max_line_len: 50000 },
        },
      },
    };
    

    【讨论】:

      【解决方案3】:

      由于 uglify 正在生成警告。如果你注意到它的Beautifier options max-line-len 默认为 32000。现在这只是一个警告,所以没有问题,但如果你想删除它,你可以在 ember build 中设置选项的值。

      【讨论】:

      • 我尝试了值 -b (and) --b (and) max-line-len (and) -max-line-len (and) --max-line-len with 'ember build --environment=production' 但都给出错误。你能告诉我如何设置这个值吗?
      • Getting "选项 '--max-line-len' 没有在构建命令中注册
      • 也许在你的ember-cli-build.js中设置选项
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-04
      • 1970-01-01
      • 1970-01-01
      • 2017-03-16
      • 1970-01-01
      相关资源
      最近更新 更多