Skip to content

Bundling fails for package bknd in turbopack #98596

Description

@shishantbiswas

Link to the code that reproduces this issue

https://github.com/shishantbiswas/bknd-next-turbopack-bundling-issue

To Reproduce

  1. Install bknd package
bun install bknd
  1. Run the production build in turbopack using
bun run build

Current vs. Expected behavior

Current behavior:

$ next build
▲ Next.js 16.3.5 (Turbopack)
✓ Running next.config.ts took 9ms
- Experiments (use with caution):
  ⨯ turbopackMinify

  Creating an optimized production build ...

-----
FATAL: An unexpected Turbopack error occurred. A panic log has been written to /var/folders/x_/4f5ssykd6pd3ztqqsvpt_rbc0000gn/T/next-panic-7296c7debb1ce282673c45bda85d5f5c.log.

To help make Turbopack better, report this error by clicking here.
-----


> Build error occurred
Error [TurbopackInternalError]: Failed to write app endpoint /page

Caused by:
- expected chunkable module for async reference

Debug info:
- Execution of get_all_written_entrypoints_with_issues_operation failed
- Execution of EntrypointsOperation::new failed
- Execution of all_entrypoints_write_to_disk_operation failed
- Execution of output_assets_operation failed
- Execution of <AppEndpoint as Endpoint>::output failed
- Failed to write app endpoint /page
- Execution of AppEndpoint::output failed
- Execution of Project::client_chunking_context failed
- Execution of *get_client_chunking_context failed
- Execution of get_global_module_id_strategy failed
- expected chunkable module for async reference
    at <unknown> (TurbopackInternalError: Failed to write app endpoint /page) {
  type: 'TurbopackInternalError',
  location: undefined
}
error: script "build" exited with code 1
```

Expected behavior:
Note: achieved using webpack build 

```sh
$ next build --webpack
▲ Next.js 16.3.5 (webpack)
✓ Running next.config.ts took 9ms

  Creating an optimized production build ...
⚠ Production code optimization has been disabled in your project. Read more: https://nextjs.org/docs/messages/minification-disabled
✓ Compiled successfully in 4.9s
✓ Finished TypeScript in 753ms    
✓ Collecting page data using 7 workers in 255ms    
[INF] 2026-09-12 09:04:53 Using node-sqlite connection file:data.db
[LOG] 2026-09-12 09:04:53 App built
✓ Generating static pages using 7 workers (4/4) in 327ms
✓ Collecting build traces in 2.2s    
✓ Finalizing page optimization in 2.2s    

Route (app)
┌ ○ /
├ ○ /_not-found
├ ƒ /admin/[[...admin]]
└ ƒ /api/[[...bknd]]


○  (Static)   prerendered as static content
ƒ  (Dynamic)  server-rendered on demand
```

### Provide environment information

```bash
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.6.0: Fri Jul 31 19:11:03 PDT 2026; root:xnu-12377.161.14~5/RELEASE_ARM64_T8132
  Available memory (MB): 16384
  Available CPU cores: 10
Binaries:
  Node: 26.4.0
  npm: 11.17.0
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 16.3.5 // Latest available version is detected (16.3.5).
  eslint-config-next: N/A
  react: 19.2.8
  react-dom: 19.2.8
  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

I was trying to create a minimal example for bknd using nextjs the dev mode ran fine without and hitches but a local production build fails the moment it begins

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    TurbopackRelated to Turbopack with Next.js.

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions