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

Fabric.js is incompatible with Require.js #729

Closed
orientalperil opened this issue Apr 28, 2013 · 1 comment
Closed

Fabric.js is incompatible with Require.js #729

orientalperil opened this issue Apr 28, 2013 · 1 comment

Comments

@orientalperil
Copy link

I am using Require.js in my project and discovered that Fabric.js is not compatible with it. Fabric.js uses the function require() (from Node.js I assume) to load dependencies. Require.js also use a function called require() for something similar. These are different functions whose names are the same and are thus clashing. Effectively this means that Fabric.js cannot be loaded using Require.js

This is the bit of code where I found an error is logged if you attempt to load Fabric.js using Require.js. From https://github.com/kangax/fabric.js/blob/v1.1.0/src/object.class.js#L17

  var Image = global.Image;
  try {
    var NodeImage = (typeof require !== 'undefined') && require('canvas').Image;
    if (NodeImage) {
      Image = NodeImage;
    }
  }
  catch(err) {
    fabric.log(err);
  }

Is there any way around this kind of name clashing?

@orientalperil
Copy link
Author

Addressed in fabricjs/fabric.js#593

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant