Skip to content

Problem using with webpack #56

@mleduque

Description

@mleduque

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions