Skip to content

Commit d06cda8

Browse files
authored
Do not create source maps for production build (OctoLinker#486)
Yesterday, I noticed that our production build is quite big. Just our `app.js.map` has already 1.5 MB. I think we don't need to ship source maps and therefore I disabled source maps for the production build.
1 parent aa03035 commit d06cda8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"package": "yarn build && web-ext build --source-dir dist --artifacts-dir out --overwrite-dest",
1616
"release": "webstore upload --source dist --auto-publish",
1717
"build": "webpack --mode=production",
18-
"watch": "webpack --watch",
18+
"watch": "webpack --watch --mode=development",
1919
"chrome-open": "yarn build && yarn chrome-launch --",
2020
"chrome-launch": "node scripts/chrome-launch.js",
2121
"firefox-open": "yarn build && yarn firefox-launch --",

webpack.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
const path = require('path');
22
const CopyWebpackPlugin = require('copy-webpack-plugin'); // eslint-disable-line
33

4-
module.exports = {
4+
module.exports = (env, argv) => ({
55
mode: 'development',
66
entry: {
77
app: './packages/core/app',
88
background: './packages/core/background/index',
99
options: './packages/helper-settings/page',
1010
},
11-
devtool: 'source-map',
11+
devtool: argv.mode === 'development' ? 'source-map' : '',
1212
output: {
1313
path: path.resolve(__dirname, 'dist'),
1414
filename: '[name].js',
@@ -27,4 +27,4 @@ module.exports = {
2727
},
2828
],
2929
},
30-
};
30+
});

0 commit comments

Comments
 (0)