From ba4626242677e29ae9a326fa01163366a0117f95 Mon Sep 17 00:00:00 2001 From: David Edmondson Date: Sun, 5 Sep 2021 11:31:40 -0700 Subject: [PATCH] Speed up sourcemaps in dev mode --- webpack.config.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index f1ef1c8d8..2d2f13362 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -22,7 +22,7 @@ module.exports = (env, argv) => { chunkModules: false, chunkOrigins: false, colors: true, - entrypoints: true, + entrypoints: false, }; const devServerSettings = { @@ -106,10 +106,25 @@ module.exports = (env, argv) => { }, }, }), - ], + // In dev mode, use a faster method of create sourcemaps + // while keeping lines/columns accurate + isDevServer && + new webpack.EvalSourceMapDevToolPlugin({ + // Exclude vendor files from sourcemaps + // This is a huge speed improvement for not much loss + exclude: ["vendor"], + columns: true, + module: true, + }), + !isDevServer && + new webpack.SourceMapDevToolPlugin({ + filename: "[file].map", + columns: true, + module: true, + }), + ].filter(Boolean), target: "web", entry: entries, - devtool: "source-map", output: { path: path.resolve(__dirname, "./"), filename: "[name].bundle.js",