enablePrerenderSourceMaps
The enablePrerenderSourceMaps option lets Node.js use existing source maps during the prerender phase of next build. When source maps are available, error stack traces point to the original source code. It defaults to true.
This option does not generate source maps. Webpack does not generate server source maps by default. To generate them when investigating prerender errors, use next build --debug-prerender.
To disable it, set enablePrerenderSourceMaps to false:
next.config.ts
import type { NextConfig } from 'next'
const nextConfig: NextConfig = {
enablePrerenderSourceMaps: false,
}
export default nextConfignext.config.js
/** @type {import('next').NextConfig} */
const nextConfig = {
enablePrerenderSourceMaps: false,
}
module.exports = nextConfigReference
| Option | Type | Default |
|---|---|---|
enablePrerenderSourceMaps | boolean | true |
Disabling source maps during prerendering can reduce build memory usage, but makes prerendering errors harder to debug.
Version History
| Version | Changes |
|---|---|
v16.3.0 | The default changed to true, regardless of whether cacheComponents is enabled. |
v16.0.0 | enablePrerenderSourceMaps moved from experimental.enablePrerenderSourceMaps to the top-level enablePrerenderSourceMaps option. |