rickshaw: `object is not a function` error after uglify minification

When minifying Rickshaw with uglify (via requirejs/r.js), I’m getting an “object is not a function” error somewhere from Rickshaw, while trying to render a bar graph. Here’s a screenshot from Chrome’s script panel, paused on uncaught exceptions: http://bassistance.de/i/50e880.png

So the error is thrown in Rickshaw.Graph.Renderer.Bar.Rickshaw.Class.create.initialize, which is reasonable, as both arguments are objects, not functions. Though I have no idea why an object is passed where a function is expected. Maybe someone more familar with the code base can tell.

Here’s the code to render the graph in our application: https://gist.github.com/5552abdf24227e5f7cb6 Without minification that works fine.

About this issue

  • Original URL
  • State: closed
  • Created 12 years ago
  • Comments: 34 (4 by maintainers)

Commits related to this issue

Most upvoted comments

I have also run into this problem using Rickshaw with require and the r.js optimiser. I bypassed the problem by changing the r.js build script to use:

uglify2: {
     mangle: false
},
optimize: "uglify2"

Which is a less agressive minification. Its a shame to do this but Rickshaw is still an awesome piece of code.

Using: “grunt-contrib-uglify”: “~0.2.0”
I applied this.

uglify: {
            options: {
                mangle: {
                    except: ["$super"]
                }
            }
        }

This works:

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

Still a rather big PITA…