-
Notifications
You must be signed in to change notification settings - Fork 153
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
Buffer is undefined when using Browserify #147
Comments
This is intentional to reduce the size of javascript library. I think you may try to use |
Ah, you are right. Thank you. |
No problem, glad to help! |
Don't use bn's toBuffer method See indutny/bn.js#147
Hello @indutny I've kept running into this for the past year or so and and just skipped the error all the time (basically, all browser reloads which is a lot, and as I'm often in a test runner, Pause On Caught Exceptions must be enabled), but now decided to see what's going on, saw the string concatenation trick and landed here on a search. Too bad I procrastinated as it's one of those dev tool annoyances whose solution was important for me but never urgent :-) Having read your reply above, I don't entirely follow, how can it reduce the library size if the function would actually be needed? Why include a library otherwise? (I'm definitely missing something.) As it's a very rare practice to trick a module bundler, what's the special circumstance with this library that necessitates it here but not elsewhere? Have you got a link that explains? |
here is more details about the issue indutny/bn.js#147
here is more details about the issue indutny/bn.js#147
What about for external dependencies? Is there a way to fake the buffer for them without changing each file? |
This fixes the failed assertion encountered when using the bundled instance of bn.js. Refer to indutny/bn.js#147 for a fuller explanation for this workaround.
This fixes the failed assertion encountered when using the bundled instance of bn.js. Refer to indutny/bn.js#147 for a fuller explanation for this workaround.
This fixes the failed assertion encountered when using the bundled instance of bn.js. Refer to indutny/bn.js#147 for a fuller explanation for this workaround.
I'm having the same problem. Any other way I can achieve this? My webpack should polyfill Buffer, but it seems there's a scope problem with bn.js where Buffer is still undefined. any advice much appreciated!! 😄 |
When using Browserify v13.0.1 I get an assertion error of Buffer being undefined. It seems commit 4ef34bd as a result of #115 (or #116?) seems to have broken this. It works for me if the require() call is left as this:
Buffer = require('buffer').Buffer;
instead of:
Buffer = require('buf' + 'fer').Buffer;
The text was updated successfully, but these errors were encountered: