-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
76 lines (68 loc) · 2.12 KB
/
Copy pathwebpack.config.js
File metadata and controls
76 lines (68 loc) · 2.12 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
var webpack = require('webpack');
var isProductionBuild = (process.argv.indexOf('--optimize-dedupe') !== -1);
console.log(`Build type: ${isProductionBuild ? 'production' : 'development'}`);
/*************************************************
* Plugins
*************************************************/
var plugins = [new webpack.DefinePlugin({
__DEV__: isProductionBuild ? 'false' : 'true',
'process.env': {
'NODE_ENV': isProductionBuild ? "'production'" : "'development'"
}
})];
if (isProductionBuild) {
plugins.push(new webpack.optimize.DedupePlugin());
plugins.push(new webpack.optimize.OccurrenceOrderPlugin());
plugins.push(new webpack.optimize.UglifyJsPlugin({
minimize: true,
compress: true,
sourceMap: true
}));
}
/*************************************************
* Configuration
*************************************************/
module.exports = {
cache: true,
entry: {
main: './src/index.jsx'
},
output: {
path: 'public/build',
filename: '[name].js',
publicPath: "/build/"
},
module: {
loaders: [
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url-loader'
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader'
},
{
test: /\.json$/,
loader: 'json-loader'
},
{
test: /\.css$/,
exclude: /font-awesome|index/,
loader: 'style!css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]'
},
{
test: /\.(js|jsx)$/,
loader: 'babel-loader',
exclude: /node_modules/,
plugins: ['transform-decorators-legacy'],
presets: ['es2015', 'react', 'stage-0']
},
{
test: /\.worker\.bundle\.js$/,
loader: 'worker-loader'
}
]
},
plugins: []
};