forked from tomchentw/redux-universal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prod.config.js
90 lines (85 loc) · 2 KB
/
prod.config.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
import merge from "lodash/object/merge";
import webpack from "webpack";
import ExtractTextPlugin from "extract-text-webpack-plugin";
import * as config from "./config";
import writeStats from "./utils/write-stats";
export const client = merge({}, config.client, {
devtool: "source-map",
output: {
filename: "[name]-[hash:8].js",
chunkFilename: "[name]-[chunkhash:8].js",
},
module: {
loaders: config.client.module.loaders.concat([
{
test: /\.jsx?$/,
loaders: ["babel"],
exclude: /node_modules/,
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract("style", "css!postcss"),
},
{
test: /\.styl$/,
loader: ExtractTextPlugin.extract("style", "css!postcss!stylus"),
},
]),
},
plugins: config.client.plugins.concat([
// extract css files
new ExtractTextPlugin("[name]-[contenthash:8].css", {
allChunks: true,
}),
// optimize
new webpack.optimize.CommonsChunkPlugin("vendor", "vendor-[hash:8].js"),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
},
}),
// stats
function() {
this.plugin("done", writeStats);
},
]),
});
export const server = merge({}, config.server, {
output: {
pathinfo: true,
},
module: {
loaders: config.server.module.loaders.concat([
{
test: /\.jsx?$/,
loader: "babel",
exclude: /node_modules/,
},
{
test: /\.css$/,
loader: "null",
},
{
test: /\.styl$/,
loader: "null",
},
]),
},
plugins: config.server.plugins.concat([
new webpack.NoErrorsPlugin(),
// optimize
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
},
}),
]),
});
export default [
client,
server,
];