From 14a16924c5a8fc80cb5b153112c5b9374bffe015 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Fri, 23 Mar 2018 17:10:09 +0100 Subject: [PATCH] Make sourcemap paths relative in production --- server/build/webpack.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/build/webpack.js b/server/build/webpack.js index 3a010885..28338137 100644 --- a/server/build/webpack.js +++ b/server/build/webpack.js @@ -136,7 +136,13 @@ export default async function getBaseWebpackConfig (dir, {dev = false, isServer // This saves chunks with the name given via require.ensure() chunkFilename: '[name]-[chunkhash].js', strictModuleExceptionHandling: true, - devtoolModuleFilenameTemplate: '[absolute-resource-path]' + devtoolModuleFilenameTemplate (info) { + if (dev) { + return '[absolute-resource-path]' + } + + return `${info.absoluteResourcePath.replace(dir, '.').replace(nextDir, './node_modules/next')}` + } }, performance: { hints: false }, resolve: {