From 262107a87d55347c421d68e5b2f2c6306b1f3df6 Mon Sep 17 00:00:00 2001 From: Sy Tran Date: Mon, 27 Sep 2021 21:03:33 +0700 Subject: [PATCH] Exclude source map from prod build --- config/webpack.common.js | 1 - templates/devtools/config/webpack.config.js | 3 ++- templates/override-page/config/webpack.config.js | 3 ++- templates/popup/config/webpack.config.js | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config/webpack.common.js b/config/webpack.common.js index 67e4508..f8e90a9 100644 --- a/config/webpack.common.js +++ b/config/webpack.common.js @@ -17,7 +17,6 @@ const common = { // the filename template for entry chunks filename: '[name].js', }, - devtool: 'source-map', stats: { all: false, errors: true, diff --git a/templates/devtools/config/webpack.config.js b/templates/devtools/config/webpack.config.js index c7d6edc..bf0b228 100644 --- a/templates/devtools/config/webpack.config.js +++ b/templates/devtools/config/webpack.config.js @@ -6,12 +6,13 @@ const common = require('./webpack.common.js'); const PATHS = require('./paths'); // Merge webpack configuration files -const config = merge(common, { +const config = (env, argv) => merge(common, { entry: { devtools: PATHS.src + '/devtools.js', panel: PATHS.src + '/panel.js', background: PATHS.src + '/background.js', }, + devtool: argv.mode === 'production' ? false : 'source-map' }); module.exports = config; diff --git a/templates/override-page/config/webpack.config.js b/templates/override-page/config/webpack.config.js index 4a12b37..4eff809 100644 --- a/templates/override-page/config/webpack.config.js +++ b/templates/override-page/config/webpack.config.js @@ -6,11 +6,12 @@ const common = require('./webpack.common.js'); const PATHS = require('./paths'); // Merge webpack configuration files -const config = merge(common, { +const config = (env, argv) => merge(common, { entry: { app: PATHS.src + '/app.js', background: PATHS.src + '/background.js', }, + devtool: argv.mode === 'production' ? false : 'source-map' }); module.exports = config; diff --git a/templates/popup/config/webpack.config.js b/templates/popup/config/webpack.config.js index cf64769..e14c5f2 100644 --- a/templates/popup/config/webpack.config.js +++ b/templates/popup/config/webpack.config.js @@ -6,12 +6,13 @@ const common = require('./webpack.common.js'); const PATHS = require('./paths'); // Merge webpack configuration files -const config = merge(common, { +const config = (env, argv) => merge(common, { entry: { popup: PATHS.src + '/popup.js', contentScript: PATHS.src + '/contentScript.js', background: PATHS.src + '/background.js', }, + devtool: argv.mode === 'production' ? false : 'source-map' }); module.exports = config;