Skip to content

use npm to provide fabricjs

Marcus Oskarsson requested to merge gh-f9bb51fe/185/mxcube/fabric_npm into master

Created by: mguijarr

Since 10 days the fabricjs team moved their server-side dependencies to "optionalDependencies" for their npm package (for the record, when fabricjs is used with Node it needs Cairo and some other C/C++ librairies to be compiled, which was quite problematic for us since we only need the client side of fabric). It is now possible for us to use the latest fabric package instead of providing our own ; there were 2 problems still, solved in this PR:

  • in package.json there is no way to tell npm we do not want to install optional dependencies for a particular package, so I ended up creating a postinstall script just to do fabricjs installation
  • it seems fabricjs is not compliant with CommonJS or AMD module styles, so I had to import it in a kind of special way (the var fabric = window['fabric'] is to make linting tool happy).

Merge request reports