The `.next/standalone/` output folder doesn't contain any sourcemaps
Nobody has claimed this yet.
- 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/afgomez/test-next
To Reproduce
Not all sourcemaps are copied over when building a standalone build.
~/code/test-next[main]% pnpm run build
~/code/test-next[main]% find .next/standalone/.next/server/chunks -name '*.js.map' | wc -l
0
~/code/test-next[main]% find .next/server/chunks -name '*.js.map' | wc -l
27
However, the copied files do reference a sourcemap
~/code/test-next[main]% grep -r sourceMappingURL .next/standalone/.next/server/chunks | wc -l
27
Current vs. Expected behavior
Expected:
- All sourcemaps are copied into the
standalone/folder.
Actual:
- No sourcemaps are copied into the
standalone/folder.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:56 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T6041
Available memory (MB): 49152
Available CPU cores: 14
Binaries:
Node: 25.6.1
npm: 11.9.0
Yarn: 1.22.22
pnpm: 10.29.3
Relevant Packages:
next: 16.2.0-canary.37 // Latest available version is detected (16.2.0-canary.37).
eslint-config-next: N/A
react: 19.2.4
react-dom: 19.2.4
typescript: 5.9.3
Next.js Config:
output: standalone
Which area(s) are affected? (Select all that apply)
Output
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
I can also reproduce this issue in Next 16.1.5.
I could not find anything in the docs mentioning that this is expected behaviour, or that it is configurable in any way.
I noticed because we run the app with node --enable-source-maps, but the stack traces still contained references to minified files. A fix for this issue will make my debugging sessions much easier 🙇
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue in the linked test-next repository with pnpm run build and output: standalone. Compare sourcemaps and sourceMappingURL references under .next/server/chunks and .next/standalone/.next/server/chunks; done means the standalone output contains the referenced sourcemaps and node --enable-source-maps produces useful stack traces.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nextjs, node.js
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100