-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.prod.js
38 lines (36 loc) · 1.06 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
const MiniCssExtractPlugin = require("mini-css-extract-plugin")
const UglifyJsPlugin = require("uglifyjs-webpack-plugin")
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin")
const merge = require('webpack-merge')
const common = require('./webpack.common.js')
let clientConfig = {
entry: {
main: ['./src/index.jsx'],
},
mode: 'production',
devtool: 'source-map',
// Webpack 4 does not have a CSS minifier, although
// Webpack 5 will likely come with one
optimization: {
minimizer: [
new UglifyJsPlugin({
cache: true,
parallel: true,
sourceMap: true // set to true if you want JS source maps
}),
new OptimizeCSSAssetsPlugin({})
]
},
plugins: [
new MiniCssExtractPlugin({
filename: "[name].css",
chunkFilename: "[id].css"
})
]
}
let serverConfig = {
entry: {
server: ['babel-polyfill', './src/server/server.js']
},
}
module.exports = [merge(common.clientConfig, clientConfig), merge(common.serverConfig, serverConfig)]