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

create-hash instead crypto.createHash #9

Closed
fanatid opened this issue Mar 31, 2016 · 5 comments
Closed

create-hash instead crypto.createHash #9

fanatid opened this issue Mar 31, 2016 · 5 comments

Comments

@fanatid
Copy link

fanatid commented Mar 31, 2016

if somebody will use this package with browserify bundle size will be awful
you can use createHash (part of crypto-browserify) for decrease bundle size without speed loss

@sindresorhus
Copy link
Owner

I don't see how this is my responsibility? It should be up to Browserify to replace the code correctly. That's the whole point of Browserify, being able to use node modules in the browser without having to care. Seems like the correct solution would be to improve the Browserify detection/replacement logic.

@fanatid
Copy link
Author

fanatid commented Mar 31, 2016

just for you information:

$ cat c.js
module.exports = require('crypto')
$ ./node_modules/.bin/browserify c.js |wc -c
542030
$ vim c.js
...
$ cat c.js
module.exports = require('create-hash')
$ ./node_modules/.bin/browserify c.js |wc -c
162758

@fanatid fanatid closed this as completed Mar 31, 2016
@sindresorhus
Copy link
Owner

@fanatid I didn't mean you were wrong. Just that you're trying to fix it in the wrong place. Your way, you'll have to try to convince every single module using crypto instead of just opening an issue on browserify and getting it resolved there for everyone.

@fanatid
Copy link
Author

fanatid commented Mar 31, 2016

@sindresorhus I agree that browserify should do this, but it's looks super hard

@sindresorhus
Copy link
Owner

You won't really know that until it's explored though, so I would still strongly encourage you to open an issue on Browserify to start a discussion about it.

As for an immediate solution. Dead-code elimination comes to mind. Both Webpack 2 and Rollup supports that.

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

2 participants