forked from Morikko/sync-tab-groups
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.prod.config.js
39 lines (37 loc) · 1.04 KB
/
webpack.prod.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const path = require('path');
const webpack = require('webpack');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const cssnano = require('cssnano');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const plugins = [
new webpack.DefinePlugin({
'process.env.IS_PROD': true,
}),
new CopyWebpackPlugin([
{
from: 'node_modules/webextension-polyfill/dist/browser-polyfill.min.js',
to: 'lib/browser-polyfill.js',
context: '../',
flatten: true,
transform: function(content, path) {
return content.toString().replace('//# sourceMappingURL=browser-polyfill.min.js.map', '')
},
},
]),
new OptimizeCssAssetsPlugin({
assetNameRegExp: /\.css$/g,
cssProcessor: cssnano,
cssProcessorOptions: { discardComments: { removeAll: true } },
canPrint: true,
}),
];
module.exports = {
output: {
path: path.resolve(__dirname, './release/build'),
},
target: 'web',
mode: 'production',
plugins,
// Prefer size and performance
devtool: 'none',
};