Exclude content scripts from source maps (#2377)

(cherry picked from commit 9bc4358e85)
This commit is contained in:
Oscar Hinton 2022-02-14 15:06:14 +01:00 committed by Hinton
parent d249a0e123
commit 214b4c7cfb
1 changed files with 11 additions and 1 deletions

View File

@ -5,6 +5,7 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin"); const CopyWebpackPlugin = require("copy-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const { AngularWebpackPlugin } = require("@ngtools/webpack"); const { AngularWebpackPlugin } = require("@ngtools/webpack");
const TerserPlugin = require("terser-webpack-plugin");
if (process.env.NODE_ENV == null) { if (process.env.NODE_ENV == null) {
process.env.NODE_ENV = "development"; process.env.NODE_ENV = "development";
@ -103,11 +104,15 @@ const plugins = [
new webpack.ProvidePlugin({ new webpack.ProvidePlugin({
process: "process/browser", process: "process/browser",
}), }),
new webpack.SourceMapDevToolPlugin({
exclude: /content\/.*/,
filename: "[file].map",
}),
]; ];
const config = { const config = {
mode: ENV, mode: ENV,
devtool: ENV === "development" ? "eval-source-map" : "source-map", devtool: false,
entry: { entry: {
"popup/polyfills": "./src/popup/polyfills.ts", "popup/polyfills": "./src/popup/polyfills.ts",
"popup/main": "./src/popup/main.ts", "popup/main": "./src/popup/main.ts",
@ -122,6 +127,11 @@ const config = {
}, },
optimization: { optimization: {
minimize: true, minimize: true,
minimizer: [
new TerserPlugin({
exclude: /content\/.*/,
}),
],
splitChunks: { splitChunks: {
cacheGroups: { cacheGroups: {
commons: { commons: {