forked from jimmylee/bare
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.options.js
More file actions
143 lines (127 loc) · 3.47 KB
/
webpack.config.options.js
File metadata and controls
143 lines (127 loc) · 3.47 KB
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
var webpack = require('webpack');
var crypto = require('crypto');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin')
var current_date = (new Date()).valueOf().toString();
var random = Math.random().toString();
var runtimeSha = crypto.createHash('sha1').update(current_date + random).digest('hex');
module.exports = {
'development_loader_js': {
test: /\.js$/,
loaders: [
'babel-loader?cacheDirectory&presets[]=stage-2,presets[]=es2015',
'eslint-loader'
],
exclude: [/node_modules/]
},
'production_loader_js': {
test: /\.js$/,
loaders: [
'babel-loader?cacheDirectory&presets[]=stage-2,presets[]=es2015',
'eslint-loader'
],
exclude: [/node_modules/]
},
'development_loader_css': {
test: /\.css$/,
loaders: [
'style-loader',
'css-loader'
]
},
'production_loader_css': {
test: /\.css$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader?modules")
},
'loader_less': {
test: /\.less$/,
loaders: [
'style-loader',
'css-loader?modules',
'less-loader'
]
},
'production_loader_less': {
test: /\.less$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader?modules!less-loader")
},
'loader_html': {
test: /\.html$/,
loaders: [
'html'
]
},
'resolve': {
extensions: [
'',
'.js'
]
},
'development_output': {
path: __dirname,
publicPath: 'http://localhost:3001/',
filename: "./dist/app.js"
},
'production_output': {
path: __dirname + '/dist',
filename: 'app.js'
},
'development_entry': {
app: [
"webpack/hot/dev-server",
"./client/index.js"
]
},
'production_entry': {
app: [
"./client/index.js"
]
},
'eslint': {
configFile: '.eslintrc',
formatter: require('eslint-friendly-formatter')
},
'development_plugins': [
new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
PRODUCTION: false
}),
new HtmlWebpackPlugin({
template: __dirname + '/server/index.html',
filename: 'index.html',
development: true
})
],
'production_plugins': [
new webpack.DefinePlugin({
PRODUCTION: true,
"process.env": {
NODE_ENV: JSON.stringify("production")
}
}),
new HtmlWebpackPlugin({
template: __dirname + '/server/index.html',
filename: 'index.html',
production: true,
sha: runtimeSha
}),
new webpack.NoErrorsPlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.DedupePlugin(),
new ExtractTextPlugin('app.css'),
new webpack.optimize.UglifyJsPlugin({
comments: false,
exclude: [
/test.*.js/,
/fixture.*.js/
],
minimize: true,
mangle: true,
compress: {
drop_debugger: true,
drop_console: true,
warnings: false
}
})
]
};