Search code examples
ember.jsbrowserifyelectron

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


when I want to build my ember electron app with ember electron:package I always get the error: Build failed.

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

    The Broccoli Plugin: [UglifyWriter] failed with:

followed by several lines of "Error at...:" (always within node_modules)

I could figure out that it must have something to do with ember-browserify. I am importing this node module in a service.js file:

import Usabilla from 'npm:usabilla-api';

The curious thing is, that with ember electron (like ember serve) everything is fine and I can use the node module without any errors. Issues only occur when I want to package the app to the .dmg and exe files for distribution.

What am I missing ? Thanks for any help or hints!


Solution

  • Your build is failing on the minification step. Possibly because of the size of one of the packages you're pulling in or because it's already been minified. Minification only happens when you're building for production or packaging which is why you're not seeing the issue when you run locally. From the EmberCLI docs on minification, where you'll find more on the minifaction step:

    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 that are causing problems:

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