-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.prod.js
71 lines (61 loc) · 1.4 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
61
62
63
64
65
66
67
68
69
70
71
const path = require('path')
const webpack = require('webpack')
const node_modules_dir = path.join(__dirname, 'node_modules')
const deps = [
// 'react/dist/react.min.js',
//'react-dom/dist/react-dom.min.js',
//'react-addons-css-transition-group/index.js',
//'react-router/dist/react-router.min.js',
'moment/min/moment.min.js',
'babel-polyfill/dist/polyfill.min.js'
]
const noParse = []
const alias = {}
deps.forEach((dep) => {
const depPath = path.resolve(node_modules_dir, dep)
alias[dep.split(path.sep)[0]] = depPath
noParse.push(depPath)
})
module.exports = {
devtool: 'source-map',
entry: [
'./src/entry'
],
resolve: {
alias,
modulesDirectories: ['src', 'node_modules', 'shared']
},
output: {
path: path.join(__dirname, 'public'),
filename: 'bundle.js',
publicPath: '/static/'
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
}
})
],
module: {
noParse,
loaders: [
{
test: /\.jsx?$/,
loaders: ['babel'],
include: path.join(__dirname, 'src')
},
{
test: /\.scss$/,
loaders: ['style', 'css', 'sass'],
include: path.join(__dirname, 'src')
}
]
}
}