-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.prod.js
66 lines (65 loc) · 2.15 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
var path = require('path');
var webpack = require('webpack')
module.exports = {
devtool: 'source-map',
entry: {
// account: './client/pages/account/index',
admin: './client/pages/admin/index',
// contact: './client/pages/contact/index',
// login: './client/pages/login/index',
// signup: './client/pages/signup/index'
},
output: {
filename: '[name].bundle.js',
chunkFilename: '[id].bundle.js',
path: path.join(__dirname, 'public'),
publicPath: '/static/'
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'core',
filename: 'core.min.js',
minSize: 2
}),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': `"${process.env.NODE_ENV}"`
},
}),
new webpack.optimize.UglifyJsPlugin(),
new webpack.optimize.AggressiveMergingPlugin()
],
resolve: {
extensions: ['.js', '.jsx']
},
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /(node_modules|bower_components)/,
include: path.join(__dirname, 'client')
},
{
test: /\.less$/,
use: [{
loader: "style-loader" // creates style nodes from JS strings
}, {
loader: "css-loader" // translates CSS into CommonJS
}, {
loader: "less-loader" // compiles Less to CSS
}]
},
{
test: /\.(eot|svg|ttf|woff|woff2)$/,
loader: 'file-loader?name=fonts/[name].[ext]'
}
// { test: /\.coffee/, loaders: ['coffee-loader'] },
// { test: /\.json/, loaders: ['json'] },
// { test: /\.s?css$/, loaders: ['style', 'css', 'sass'] },
// { test: /\.png$/, loader: "url-loader?limit=100000" },
// { test: /\.jpg$/, loader: "file-loader?name=[path][name]" },
// { test: /\.svg/, loader: "file-loader" }
]
},
}