rsnext/docs/advanced-features/source-maps.md
Rich Haines 6a00a1b464
Updated copy around enabling source maps (#36852)
This PR updates the copy in the source maps section of the docs to reflect the improvement made to webpack that generate source maps.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
2022-05-12 11:45:23 +00:00

851 B

description
Enables browser source map generation during the production build.

Source Maps

Source Maps are enabled by default during development. During production builds, they are disabled to prevent you leaking your source on the client, unless you specifically opt in with the configuration flag.

Configuration flag

Next.js provides a configuration flag you can use to enable browser source map generation during the production build:

// next.config.js
module.exports = {
  productionBrowserSourceMaps: true,
}

When the productionBrowserSourceMaps option is enabled, the source maps will be output in the same directory as the JavaScript files. Next.js will automatically serve these files when requested.

Caveats

  • Adding source maps can increase next build time
  • Increases memory usage during next build