Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not try to access length of minified code if minification failed #59

Merged
merged 1 commit into from
Jan 11, 2018

Conversation

kmoe
Copy link
Contributor

@kmoe kmoe commented Jan 11, 2018

If UglifyJS.minify(src, options) (line 116) fails, the result object will have the following form:

{
  error: [uglifyjs stack trace]
}

In this case, attempting to access result.code.length causes broccoli to fail with Cannot read property 'length' of undefined, and the error report file shows only the stack trace for this error, not the actual minification error.

Moving the debug line below the throw ensures that the user sees the real cause of the error (the uglifyjs stack trace) in the console and error report file.


Happy to add example or test if necessary - discovered during a long broccoli debugging session...

@stefanpenner stefanpenner merged commit 2382db5 into ember-cli:master Jan 11, 2018
@stefanpenner
Copy link
Collaborator

released as v2.0.2 🎉

@Turbo87 Turbo87 added the bug label May 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants