garex/nodejs-color-difference

this code cannot be browserified

Pomax opened this issue · 3 comments

By using this:

module.exports = require(process.env.COLOR_DIFFERENCE_COVERAGE
    ? './.coverage/lib'
    : './lib'
  );

Browserify cannot determine what it should actually include when building a package that uses color-difference. It's probably worth adding a main property to your package.json that simply straight up points to ./lib/index.js instead, and keep the root index.js exporting ./coverage/lib:

  ...
  "bin": {
    "color-difference": "./bin/color-difference"
  },
  "main": "./lib",
  "repository": {
    "type": "git",
    "url": "git://github.com/garex/nodejs-color-difference.git"
  },
  ...

solves the problem of browserify breaking when color-difference is used

@Pomax hi. can you send some stupid PR on this? I'm currently "not here" mentally. I'll review I will understand more details.

sure, I'll try get that done tonight

garex commented

fixed in #9