-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.prod.js
60 lines (58 loc) · 1.34 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
const webpack = require('webpack')
const autoprefixer = require('autoprefixer')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const path = require('path')
const prodConfig = {
devtool: 'source-map',
entry: ['./src/client/main.js'],
output: {
path: path.join(__dirname, 'public/dist'),
filename: 'app.js',
publicPath: '/dist/'
},
module: {
rules: [
{
test: /\.jsx?/,
use: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
use: [
'css-loader?sourceMap&importLoaders=1',
{
loader: 'postcss-loader',
options: {
plugins: () => [require('autoprefixer')]
}
},
'sass-loader?sourceMap'
]
})
},
{
test: /\.json$/,
loader: 'json-loader'
}
]
},
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new ExtractTextPlugin({
filename: 'app.css',
allChunks: true
}),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true
}),
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
]
}
module.exports = prodConfig