brunch / terser-brunch

A javascript minifier for brunch files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uglify breaks RickShaw

kursion opened this issue · comments

Hi,

it seems that Uglify doesn't work very well with D3JS (v3.0) and also with RickShaw.

When uglified there is an error for RickShaw:

"Uncaught TypeError: undefined is not a function "

Best regards

Ok, but you missed my first point. We do not maintain the Uglify library, just use it. You should try directly running Uglify on these scripts to see if there is a problem, and if so let the Uglify and/or library authors know about it.

It's only something for us to look into and fix if directly uglifying works, but through brunch it does not.

Or if you want the easy answer, just use the pre-minified versions provided by the library authors in your project.

you can't

or you can move it to app/assets and it will be simply copied

Hello paulmillr, I deleted my comment since I find out that it was impossible (but you were to fast) :p
Ty guys

Just try dropping in the pre-minified one. It will run through Uglify, but maybe it won't break that version.

On Aug 21, 2013, at 9:46 AM, kursion notifications@github.com wrote:

Hello paulmillr, I deleted my comment since I find out that it was impossible :p


Reply to this email directly or view it on GitHub.

I tried both: first the non minified, then the minified version of RickShaw. Both failed...

oh that sucks... well I think at this point dropping it in assets as @paulmillr suggested and making a separate <script> tag for it in your HTML will be your best bet.

And you should report this to https://github.com/mishoo/UglifyJS2

Hi,
this is a known problem, as you can see in this Rickshaw issue: shutterstock/rickshaw#52

This comment shutterstock/rickshaw#52 (comment) provide a solution working for requireJS. I test it with brunch that way:

plugins: {
    uglify:{
        except: ["$super"]
    }
},

but it didn't work. Is except option managed by uglify-js-brunch plugin?

All the options are passed through as-is https://github.com/brunch/uglify-js-brunch/blob/master/index.js#L53

So if it works directly with the uglify js api it should work here.

Just tried this

plugins: {
    uglify:{
        mangle: false
    }
},

and it works just fine :)

Hope this workaround will be useful for others, cause it's better than put Rickshaw in asset folder.