Hashwords doesn't load in SystemJS bundle
I'm using hashwords in an Aurelia project, with JSPM and SystemJS. During development mode, it works great. But when bundling, having some issues:
First is error "hashwords is not defined". This is caused by this line in index.js:
hashwords = require('./lib/hashwords');
Changing it to this fixes the problem:
var hashwords = require('./lib/hashwords');
However, that leads to the second problem: "md5 is not a function", in hashwords.js, function tokensFromString:
hash += md5(hash);
This is because in bundled mode, this line in hashwords.js returns undefined:
md5 = require('./md5').md5;
Just as an experiment, I modified lib/md5.js, removed the IIFE wrapping it, and instead of the define check, replaced with node style module.exports, and that solved the problem:
module.exports = {
md5: md5
};
Does anyone know how to make this library work within a SystemJS bundle without modifying the code? Otherwise I could submit a PR with my fixes, except I'm not sure if this would break other usages such as via bower install.