From 87f79270a0af792c1949a8941d1448a0ff8dc47a Mon Sep 17 00:00:00 2001 From: Tomas Carnecky Date: Thu, 24 Oct 2019 09:26:38 +0200 Subject: [PATCH] Enable source maps in production --- app/next.config.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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; }