Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

101
Views
Webpack (or babel) appears to be replacing all instances of NodeJS Streams with standard ReadableStreams

So, I'm in the process of doing a long overdue update on a Node-based project, bundled with webpack and babel. In the process of updating webpack beyond v4, I've set up some of the polyfills I need by adding a resolve.fallback section to the config in my webpack.config.js:

    resolve: {
      extensions: [".ts", ".tsx", ".html", ".js"],
      fallback: {
        buffer: require.resolve("buffer"),
        crypto: require.resolve("crypto-browserify"),
        stream: require.resolve("stream-browserify"),
      },
    },

However, something (I suspect these polyfills, but I'm not sure) is now causing all instances of NodeJS Streams in my project to wind up being standard ReadableStreams, including the body of a response from an explicitly-imported node-fetch:

import {default as nodefetch} from 'node-fetch'
[...]
  const response = await nodefetch(endpointURI, {
    method: "POST",
    headers: {
      Authorization: authToken,
      Origin: window.location.host,
    },
    body: JSON.stringify(data),
  });
  return response.body;  // Attempting to call `response.body.pipe()` here 
                         // will result in a "not a function" error. In a debugger,
                         // response.body appears to be a standard (Non-Node) ReadableStream.

So, not sure why this is happening but I'd love to find out! Relevant versions:

node: v16.15.1
node-fetch@2.6.7
webpack-cli@4.10.0
webpack@5.73.0
stream-browserify@3.0.0
@babel/core@7.18.6
@babel/preset-env@7.18.6
@babel/preset-react@7.18.6
@babel/preset-typescript@7.18.6
@babel/runtime@7.18.6
about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!