ethanent / phin

Node HTTP client
MIT License
576 stars 33 forks source link

ReferenceError: Buffer is not defined #72

Closed philosofonusus closed 3 years ago

philosofonusus commented 3 years ago
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.

philosofonusus commented 3 years ago

After some researches i managed to find solution:

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

just add these lines in webpack config.