ember electron:package 构建失败,由 ember-browserify 引起

ember electron:package build failed, caused by ember-browserify

当我想用 ember electron:package 构建我的 ember 电子应用程序时 我总是得到错误: 构建失败。

File: assets/vendor.js (91129:6)

    The Broccoli Plugin: [UglifyWriter] failed with:

后跟几行 "Error at...:"(总是在 node_modules 之内)

我猜想这一定与 ember-browserify 有关。 我正在 service.js 文件中导入此节点模块:

import Usabilla from 'npm:usabilla-api';

奇怪的是,使用 ember electron(如 ember 服务)一切正常,我可以毫无错误地使用节点模块。只有当我想将应用程序打包到 .dmg 和 exe 文件以进行分发时才会出现问题。

我错过了什么? 感谢您的帮助或提示!

您的构建在缩小步骤中失败。可能是因为您要拉入的其中一个包裹的大小,或者因为它已经被缩小了。缩小仅在您为生产或包装构建时发生,这就是为什么您在本地 运行 时看不到问题。 在 EmberCLI docs on minification 中,您可以在其中找到有关 minifaction 步骤的更多信息:

the js-files are minified with broccoli-uglify-js in the production-env by default. You can pass custom options to the minifier via the minifyJS:options object in your ember-cli-build

You can exclude specific files/resources 导致问题:

To exclude assets from dist/assets from being minificated, one can pass options for broccoli-uglify-sourcemap

我刚刚在 C 驱动器中创建了演示应用程序,它运行良好。