forked from afcidk/HackMDir
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.js
63 lines (61 loc) · 1.44 KB
/
webpack.prod.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
const path = require('path')
const webpack = require('webpack')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin')
const DIST_DIR = path.resolve(__dirname, 'dist')
const SRC_DIR = path.resolve(__dirname, 'src')
module.exports = {
mode: 'production',
entry: {
background: ['babel-polyfill', SRC_DIR + '/background.js'],
content: ['babel-polyfill', SRC_DIR + '/content.js']
},
output: {
path: DIST_DIR,
filename: '[name].js',
publicPath: './'
},
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
new CopyWebpackPlugin([
{ from: './src/manifest.json' },
{ from: './src/icons/', to: './icons' }
])
],
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
extractComments: true,
cache: true,
parallel: true,
sourceMap: true,
terserOptions: {
extractComments: 'all',
compress: {
drop_console: true
}
}
})
]
},
resolve: { extensions: ['.js', '.jsx'] },
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: ['/node_modules/', '/src/api'],
include: /src/,
use: 'babel-loader'
},
{
test: /\.(scss|sass)$/,
use: ['style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.(html)$/,
use: ['html-loader']
}
]
}
}