diff --git a/app/next.config.js b/app/next.config.js index 3f7333c6b1..d86ad0db98 100644 --- a/app/next.config.js +++ b/app/next.config.js @@ -20,6 +20,28 @@ module.exports = withBundleAnalyzer( // /node_modules/ // ] // }); + + /* Enable source maps in production */ + if (!dev) { + config.devtool = "source-map"; + + for (const plugin of config.plugins) { + if (plugin.constructor.name === "UglifyJsPlugin") { + plugin.options.sourceMap = true; + break; + } + } + + if (config.optimization && config.optimization.minimizer) { + for (const plugin of config.optimization.minimizer) { + if (plugin.constructor.name === "TerserPlugin") { + plugin.options.sourceMap = true; + break; + } + } + } + } + return config; }