Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

109
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda