-
Notifications
You must be signed in to change notification settings - Fork 299
Buffer shim is no longer working in the Browser as expected #651
Conversation
cc @diasdavid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @joaosantos15! Will this PR bring the fix as well?
test/files.spec.js
Outdated
@@ -62,6 +62,21 @@ describe('.files (the MFS API part)', function () { | |||
}) | |||
}) | |||
|
|||
it('file.add with NPM Buffer', (done) => { | |||
let Buffer = require('buffer/').Buffer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the /
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's to depend on that module specifically. I tested without it and it was using Nodejs core Buffer module.
I read about the usage here:.
To require this module explicitly, use require('buffer/') which tells the node.js module lookup algorithm (also used by browserify) to use the npm module named buffer instead of the node.js core module named buffer!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no buffer
package being imported. Am I missing some point?
@hacdias mind checking this one? |
@joaosantos15 @diasdavid I've got one thing to ask: we support the native Node.js Buffer. So, why are trying to support Why don't we do something similar to what |
@diasdavid could you take a look at my previous comment? 😄 |
@hacdias the feross/Buffer package is the browser shim that every Bundler (browserify, webpack, etc) uses to shim the Node.js Buffer. I started getting this issue as well on #688 I believe @vmx had found problems with feross/Buffer package. @vmx will feross/buffer#178 fix this issue? |
@diasdavid I don't think feross/buffer#178 will fix the issue. Though I think that once feross/buffer#177 is done, it might fix the issue (178 is just a small part of that. But I won't spend more time on it until I got feedback on it). |
merging into a branch so that we all can edit. |
Follow on #689 |
For #649
Adds a failing test for when adding an NPM Buffer: