-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.prod.js
44 lines (42 loc) · 1.11 KB
/
webpack.config.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
const path = require('path')
const merge = require('webpack-merge')
const TerserPlugin = require('terser-webpack-plugin')
const terserConfig = require('./config/terserConfig')
const webpack = require('webpack')
const CleanWebpackPlugin = require('clean-webpack-plugin').CleanWebpackPlugin
const banner = require('./config/banner')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const config = {
target: 'web',
entry: {
'barcodegenerator.min': [
'./src/scss/barcodegenerator.scss',
'./src/core.js'
]
},
mode: 'production',
context: path.resolve(__dirname),
devtool: '',
optimization: {
usedExports: true,
minimize: true,
minimizer: [new TerserPlugin(terserConfig)]
},
plugins: [
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: [path.resolve(__dirname, 'dist')],
verbose: true,
dry: false
}),
new MiniCssExtractPlugin({
filename: '[name].css'
}),
new webpack.BannerPlugin({
banner: banner.production,
entryOnly: true
})
]
}
module.exports = (common, env) => {
return merge.smart(common, config)
}