-
Notifications
You must be signed in to change notification settings - Fork 32
JS minify failed on public/javascripts/app.js: TypeError: Cannot assign to read only property 'except' of [object Object] #7
Comments
does uglify works if you do it w/o brunch with these params? |
If I invoke uglifyjs with the following command line: uglifyjs -m -c -r "require" public/javascripts/app.js It works just fine. |
ah, indeed this is the issue, just checked code. @es128 seems it’s from your changes |
I believe I'm just passing through the config parameters as-is. Perhaps these are malformed for what the ugiify API expects? You sure |
If you look at the uglifyjs source, except is configurable and expected to be an array: https://github.com/mishoo/UglifyJS2/blob/master/bin/uglifyjs#L130 |
The issue is definitely happening within Uglify, though, and you're trying to use the config options in an undocumented way. The only documented usage I can see via the node API is |
It is not undocumented. Uglify's command line allows for reserved identifiers: https://github.com/mishoo/UglifyJS2#usage (see -r/--reserved) And grunt's uglify plugin uses the very same except array: https://github.com/gruntjs/grunt-contrib-uglify/blob/master/README.md#reserved-identifiers |
Moreover, if I hack my own object into uglify-js-brunch/lib/index.js:
That works just fine. For whatever reason, the config object as it is in the source is causing "TypeError: Cannot assign to read only property" |
It's undocumented in terms of the Uglify.minify API method, but yes you've proven your point. I'm glad you were able to isolate the issue further. I'll see if I can figure it out. |
Ok, looks like I found the source of the issue and a solution. PR on its way. @paulmillr Brunch's freeze/deepFreeze stuff has turned out to have lots of side effects. This issue for one, but most notably the watching/changing of config.coffee. How important is it to keep doing that? |
Works fine, now. Thanks for the quick turnaround! |
whats up with plugins like that -- sass etc? |
I'll check, but for the most part I don't think they just copy the whole object from config like this one. |
Has this issue resurfaced? When using uglify-js-brunch 1.7.4, it works just fine. When I upgrade to 1.7.6, I get the same error I originally reported. |
Any points on how can this be reproduced? |
Looks like 7b1610a dropped the |
We don't have any nested objects so it should not matter. |
Sure we do. Isn't that the whole source of the problem? |
I see. There are arrays. Should be fixed now. @rtruong try |
Works fine, now. Thanks for the quick turnaround! |
When using uglify-js-brunch with the following configuration (from config.coffee):
With the following command line:
I get the following error.
I'm using node v0.10.5, brunch 1.6.3, and uglify-js-brunch 1.5.1.
The text was updated successfully, but these errors were encountered: