Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hashwords doesn't load in SystemJS bundle #4

Open
danielabar opened this issue Dec 14, 2016 · 0 comments
Open

Hashwords doesn't load in SystemJS bundle #4

danielabar opened this issue Dec 14, 2016 · 0 comments

Comments

@danielabar
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant