ethanent / phin

Node HTTP client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ReferenceError: Buffer is not defined

philosofonusus opened this issue · comments

ReferenceError: Buffer is not defined
    at eval (util.js?9eb9:103)
    at Object.../node_modules/core-util-is/lib/util.js (route-discover.chunk.125f9.js:126)
    at __webpack_require__ (bundle.js:833)
    at fn (bundle.js:130)
    at Object.eval (_stream_readable.js?0740:67)
    at eval (_stream_readable.js:1040)
    at Object.../node_modules/readable-stream/lib/_stream_readable.js (route-discover.chunk.125f9.js:460)
    at __webpack_require__ (bundle.js:833)
    at fn (bundle.js:130)

Please help me. I do need your help a lot.
The problem is that global variable Buffer is defined in nodejs but not in browser, so we need to have polyfill.

After some researches i managed to find solution:

module.exports = {
  ...
  node: {
    process: true,
    Buffer: true
  }
}

just add these lines in webpack config.