-
Notifications
You must be signed in to change notification settings - Fork 156
Build error: SWC fails to read source map for dist/index.js with Bun #317
Copy link
Copy link
Open
Description
Description
When building a Next.js app that depends on chat@4.23.0 using Bun as the package manager, the SWC compiler fails with:
ERROR failed to read input source map: failed to find input source map file "index.js.map"
in "node_modules/.bun/chat@4.23.0/node_modules/chat/dist/index.js" file
as either "node_modules/.bun/chat@4.23.0/node_modules/chat/dist/index.js.map"
or with appended .map
at crates/swc/src/lib.rs:398
Details
The source map file (dist/index.js.map) is present in the package and is valid JSON. The issue appears to be that SWC cannot resolve the source map through Bun's internal module cache path (node_modules/.bun/).
dist/index.js ends with:
//# sourceMappingURL=index.js.mapThe file dist/index.js.map exists and is ~316KB of valid JSON, but SWC fails to locate it when the package is installed via Bun.
Reproduction
- Create a Next.js app using Bun as the package manager
- Install
chat@4.23.0 - Import from
chatin any server-side code - Run
next build
Environment
chat: 4.23.0- Next.js: 16
- Bun: 1.3
- macOS (Darwin 25.3.0)
Workaround
Adding chat to serverExternalPackages in next.config.ts avoids the error:
const nextConfig: NextConfig = {
serverExternalPackages: ["chat"],
};Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels