Fabric.js: Webpack support

Created on 10 Dec 2015  路  7Comments  路  Source: fabricjs/fabric.js

Has anyone gotten fabric to work with webpack?

Most helpful comment

I found that I could use Fabric in my project if I built on a system that could natively build node-canvas. Another sticky point I had was the fabric global variable, which was solved by this useful stackoverflow question and accepted response.

All 7 comments

please for this kind of queation refer to google group or stack overflow. Here we manage bugs or nee features for fabricjs.

@arianitu did you ever get fabric to work with webpack?

@playground did you ever get fabric to work with webpack or rollup?

if your system cannot install canvas for node, it won't work.

please put fabric library in a folder and instruct webpack that it is a dependency and not a part of the app

@itsazzad, node-canvas is natively compiled. In order for it to work with webpack we will need a statically compiled version. I'm waiting for this PR to get merged.

I found that I could use Fabric in my project if I built on a system that could natively build node-canvas. Another sticky point I had was the fabric global variable, which was solved by this useful stackoverflow question and accepted response.

ok so i made this thing here:

https://travis-ci.org/fabricjs/fabricjs-webpack/

this is just an example, i took latest webpack, latest node ( to have latest npm ) and build a simple webpack bundle with fabricJS.

What i can see is that the build succedes, there are information stating that xmldom and jsdom are not bundled.

Then i test this on travis with a linux docker image where canvas can't be installed because libs are missing, npm throws warning says that an unmet optional dep is missing ( canvas ) but the intall does not fail. The build run.

So at least with latest tools chain everything works

Was this page helpful?
0 / 5 - 0 ratings