Skip to content

Loading…

require('canvas') statement breaks Browserify or RequireJS builds #28

Closed
bvalosek opened this Issue · 2 comments

2 participants

@bvalosek

The conditional require('canvas') statement on line 388 causes the build to break when using Browserify or the RequireJS optimizer.

This happens because the build tools look through the source and find all calls to require() and attempt to eagerly include them, since whether or not the code would actually execute is cannot be known at built time.

This means Browserify / RequireJS attempt to resolve the canvas module, which isn't found (or needed, as we are targeting the browser).

Removal of the require() call fixes this issue.

@zakangelle

What this dude said.

@jasondavies jasondavies added a commit that closed this issue
@jasondavies Remove require from main layout file.
This also includes a backwards-incompatible change to module naming when
used with Node.js: instead of require("d3-cloud").cloud, you should now
use require("d3-cloud") directly.

Fixes #28.
a81e468
@bvalosek

Perfect, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.