-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack-client.config.build.js
127 lines (124 loc) · 3.13 KB
/
webpack-client.config.build.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
118
119
120
121
122
123
124
125
126
127
'use strict';
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const AssetsPlugin = require('assets-webpack-plugin');
process.env.NODE_ENV= 'production';
process.env.BABEL_ENV = 'production';
module.exports = {
devtool: 'cheap-source-map',
stats: {
children: false,
colors: true
},
entry: {
'bundle.generator-mvp': './src/client/boot/task-manager.entry.js'
},
output: {
publicPath: '/',
path: './build/client',
filename: 'scripts/[name].[chunkhash].js',
chunkFilename: 'scripts/[name].[chunkhash].js'
},
resolve: {
modules: ["src", "node_modules"]
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"'
}),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
output: { comments: false },
compressor: { warnings: false },
sourceMap: true
}),
new webpack.optimize.AggressiveMergingPlugin(),
new ExtractTextPlugin('styles/[name].[chunkhash].css'),
new AssetsPlugin({filename: 'webpack-assets.json', path: __dirname + '/build/server/views'})
//new webpack.optimize.CommonsChunkPlugin({name: 'commons'})
],
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
use: [
{
loader: 'babel-loader',
options: {
cacheDirectory: true,
sourceMaps: true,
plugins: ['transform-object-assign'],
presets: [
['react'],
['es2015', {modules: false}]
]
}
}
]
},
{
test: /\.(jpe?g|png|gif|svg)$/,
use: [
{
loader: 'url-loader',
options: {
name: 'images/[name].[ext]',
limit: 4000
}
},
{
loader: 'image-webpack-loader',
options: {
bypassOnDebug: false,
mozjpeg: {progressive: true},
gifsicle: {interlaced: false},
optipng: {optimizationLevel: 7},
pngquant: {
quality: '75-90',
speed: 3
}
}
}
]
},
{
test: /\.(scss|css)$/,
loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{
loader: 'css-loader',
options: {
modules: true,
localIdentName: '[name]__[local]___[hash:base64:5]'
}
},
{
loader: 'postcss-loader',
options: { parser: 'postcss-scss' }
}
]
})
},
{
test: /\.(ttf|eot|woff|woff2)$/,
use: [
{
loader: 'file-loader',
options: { name: 'fonts/[name].[ext]' }
}
]
},
{
test: /\.html$/,
use: [
{
loader: 'html-loader',
options: { name: 'templates/[name].[ext]' }
}
]
}
]
}
};