HumbleSoftware / js-imagediff

JavaScript / Canvas based image diff utility with Jasmine matchers for testing canvas.
http://humblesoftware.github.com/js-imagediff/
MIT License
788 stars 99 forks source link

Problem using with webpack #56

Open mleduque opened 8 years ago

mleduque commented 8 years ago

I'm trying to use imagediff with webpack (actually, karma-webpack). During "compilation", I get

ERROR in ./~/imagediff/imagediff.js
Module not found: Error: Cannot resolve module 'fs' in [...]/node_modules/imagediff
 @ ./~/imagediff/imagediff.js 336:4-17

Then the tests are launched and I see

  Uncaught TypeError: Cannot read property 'imagediff' of undefined
  at [...]/karma/tests/visualfill.js:69949 <- webpack:///~/imagediff/imagediff.js:37:4

Looking a bit at the source (not that I understand much), I see things like

  if (typeof module !== 'undefined') {
    imagediff.imageDataToPNG = imageDataToPNG;
  }

even though I think webpack defines module.

Also

(function (name, definition) {
  var root = this;

I think this is undefined there (in strict mode).