Skip to content

Turbopack does not support imports from stream/consumers #90765

@paulbrimicombe

Description

@paulbrimicombe

Link to the code that reproduces this issue

https://github.com/paulbrimicombe/nextjs-stream-consumers-bug?target=https://github.com

To Reproduce

  1. Install dependencies: npm install
  2. Attempt to build the code using Turbopack: npm run build — the error Module not found: Can't resolve 'stream/consumers' will be displayed
  3. Attempt to build the code using Webpack: npm run build -- --webpack — no errors will be shown
  4. Update the code in page.tsx to add the node: prefix to the stream/consumers import
  5. Attempt to build the code using Turbopack: npm run build — the error Cannot find module 'node:stream/consumers': Unsupported external type Url for commonjs reference will be displayed

Current vs. Expected behavior

  • Utility consumer functions should be able to be imported without the node: prefix (like other Node.js libraries).
  • These functions should be able to be imported in CommonJS code

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Wed Nov  5 21:30:44 PST 2025; root:xnu-11417.140.69.705.2~1/RELEASE_ARM64_T6041
  Available memory (MB): 24576
  Available CPU cores: 14
Binaries:
  Node: 22.21.1
  npm: 11.10.0
  Yarn: 1.22.22
  pnpm: 10.28.0
Relevant Packages:
  next: 16.1.6 // Latest available version is detected (16.1.6).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Turbopack

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

A quick search of the Turbopack codebase for similar Node.js libraries such as stream/promises or stream/web indicates that there is some missing handling for stream/consumers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    TurbopackRelated to Turbopack with Next.js.linear: turbopackConfirmed issue that is tracked by the Turbopack team.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions