# 源映射

在开发过程中默认启用源映射。在生产构建期间,它们被禁用,因为生成源映射会显著增加构建时间和生成时的内存使用。

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 productionBrowserSourceMapsoption 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 buildtime
  • Increases memory usage during next build
Last Updated: 5/13/2023, 8:55:38 PM