-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
51 lines (49 loc) · 1.43 KB
/
webpack.config.js
File metadata and controls
51 lines (49 loc) · 1.43 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
module.exports = (env, argv) => {
const isProduction = argv.mode === 'production';
return {
mode: argv.mode || 'development',
entry: {
background: './src/background.js',
'content/init': './src/content/init.js',
'popup/popup': './src/popup/popup.js'
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
clean: !isProduction
},
devtool: isProduction ? false : 'cheap-module-source-map',
optimization: {
minimize: isProduction,
usedExports: true,
sideEffects: false
},
performance: {
hints: isProduction ? 'warning' : false,
maxEntrypointSize: 512000,
maxAssetSize: 512000
},
plugins: [
new CopyPlugin({
patterns: [
{ from: 'src/content/logger.js', to: 'content/' },
{ from: 'src/content/cleanupLogger.js', to: 'content/' },
{ from: 'src/popup/popup.html', to: 'popup/' },
{ from: 'src/popup/popup.css', to: 'popup/' },
{ from: 'manifest.json', to: '.' },
{ from: 'icons', to: 'icons' }
]
})
],
resolve: {
extensions: ['.js'],
alias: {
'@utils': path.resolve(__dirname, 'src/utils'),
'@content': path.resolve(__dirname, 'src/content'),
'@popup': path.resolve(__dirname, 'src/popup')
}
}
};
};