vercel / vercel/next.js

Bundling fails for package `bknd` in turbopack

Open
#98,596 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Turbopack
Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked bknd-next-turbopack-bundling-issue reproduction and run bun install bknd followed by bun run build. Compare the failing Turbopack next build with the successful next build --webpack, focusing on the reported expected chunkable module for async reference error. Done means the production Turbopack build completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, next.js, react
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.