Skip to content

Turbopack: Bun APIs don't work with next #75220

Description

@brrock

Link to the code that reproduces this issue

https://github.com/brrock/buntestapis/

To Reproduce

Start the app with bun run --bun dev --turbo pack and use the form the api route should fail to compile even though I'm using bun and have bun types installed

Current vs. Expected behavior

I expect this to just use the bun runtime and compile and work simply work but throws this error Error:

 ✓ Compiled /api/s3write in 377ms
 ⨯ ./app/api/s3write/route.ts:2:1
Module not found: Can't resolve 'bun'
  1 | // app/api/s3write/route.ts
> 2 | import { S3Client } from "bun";
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  3 | import { NextResponse } from 'next/server';
  4 |
  5 | // Initialize S3 client

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: kernel 6.12.9-arch1-1
  Available memory (MB): 15763
  Available CPU cores: 4
Binaries:
  Node: 23.6.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: 9.15.4
Relevant Packages:
  next: 15.1.6 // Latest available version is detected (15.1.6).
  eslint-config-next: 15.1.6
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.3
Next.js Config:
  output: N/A

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

Runtime

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

next dev (local)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions