From 214b4c7cfb8b06d9c1115352ab2a7ca93e6726ed Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Mon, 14 Feb 2022 15:06:14 +0100 Subject: [PATCH] Exclude content scripts from source maps (#2377) (cherry picked from commit 9bc4358e85ad709e12de9c6aeef0db19f7c30468) --- webpack.config.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/webpack.config.js b/webpack.config.js index 7c901c83ab..8fb09afc3a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -5,6 +5,7 @@ const HtmlWebpackPlugin = require("html-webpack-plugin"); const CopyWebpackPlugin = require("copy-webpack-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const { AngularWebpackPlugin } = require("@ngtools/webpack"); +const TerserPlugin = require("terser-webpack-plugin"); if (process.env.NODE_ENV == null) { process.env.NODE_ENV = "development"; @@ -103,11 +104,15 @@ const plugins = [ new webpack.ProvidePlugin({ process: "process/browser", }), + new webpack.SourceMapDevToolPlugin({ + exclude: /content\/.*/, + filename: "[file].map", + }), ]; const config = { mode: ENV, - devtool: ENV === "development" ? "eval-source-map" : "source-map", + devtool: false, entry: { "popup/polyfills": "./src/popup/polyfills.ts", "popup/main": "./src/popup/main.ts", @@ -122,6 +127,11 @@ const config = { }, optimization: { minimize: true, + minimizer: [ + new TerserPlugin({ + exclude: /content\/.*/, + }), + ], splitChunks: { cacheGroups: { commons: {