-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.production.js
117 lines (115 loc) · 3.86 KB
/
webpack.config.production.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
const path = require('path')
const webpack = require('webpack')
module.exports = {
context: path.resolve(__dirname, 'client'),
target: 'web',
devtool: 'cheap-module-source-map',
entry: {
babelPolyFill: 'babel-polyfill',
app: path.resolve('client', 'src', 'main.jsx')
},
output: {
path: path.resolve(__dirname, 'server', 'public', 'js'),
filename: '[name].bundle.js'
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
enforce: 'pre', // preload the jshint loader
exclude: [/node_modules/],
use: [
{
loader: 'eslint-loader'
}
]
}, {
test: /\.(js|jsx)$/,
exclude: [/node_modules/],
use: [
{
loader: 'babel-loader',
options: {
plugins: ['transform-decorators-legacy' ],
presets: ['es2015', 'react', 'stage-0']
}
}
]
}, {
test: /\.css$/,
use: [
{
loader: 'style-loader' // creates style nodes from JS strings
}, {
loader: 'css-loader' // translates CSS into CommonJS
}
]
}, {
test: /\.scss$/,
use: [
{
loader: 'style-loader' // creates style nodes from JS strings
}, {
loader: 'css-loader' // translates CSS into CommonJS
}, {
loader: 'sass-loader' // compiles Sass to CSS
}
]
}, {
test: /\.(png|jpg|gif)$/,
loader: 'url-loader',
options: {
limit: 10000
}
}, {
test: /\.eot(\?\S*)?$/,
loader: 'url-loader?limit=100000&mimetype=application/vnd.ms-fontobject'
}, {
test: /\.woff2(\?\S*)?$/,
loader: 'url-loader?limit=100000&mimetype=application/font-woff2'
}, {
test: /\.woff(\?\S*)?$/,
loader: 'url-loader?limit=100000&mimetype=application/font-woff'
}, {
test: /\.ttf(\?\S*)?$/,
loader: 'url-loader?limit=100000&mimetype=application/font-ttf'
}, {
test: /\.svg(\?\S*)?$/,
loader: 'url-loader?limit=100000&mimetype=image/svg+xml'
}
]
},
plugins: [
new webpack
.optimize
.CommonsChunkPlugin({
name: 'commons',
filename: 'commons.js',
minChunks: 2
}),
new webpack.optimize.UglifyJsPlugin({
minimize: true,
compress: {
warnings : false
}
}),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
})
],
resolve: {
alias: {
commons: path.join(__dirname, 'client', 'src', 'commons'),
components: path.join(__dirname, 'client', 'src', 'components'),
api: path.join(__dirname, 'client', 'src', 'api'),
stylesheets: path.join(__dirname, 'client', 'stylesheets'),
bower_components: path.join(__dirname, 'client', 'bower_components'),
public: path.join(__dirname, 'server', 'public'),
stores: path.join(__dirname, 'client', 'src', 'stores')
},
extensions: ['.js', '.jsx']
}
// externals: /^(jquery|\$)$/i
}