-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
66 lines (63 loc) · 1.9 KB
/
webpack.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
'use strict';
const webpack = require("webpack");
const WebpackDevServer = require("webpack-dev-server");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const path = require("path");
const fs = require("fs");
const mergeWith = require('lodash/mergeWith');
const isDev = process.env.NODE_ENV !== 'production';
module.exports = {
entry: {
'main': ['webpack-dev-server/client?http://localhost:8080/',
'webpack/hot/dev-server',
'./src/entries/main.js']
},
output: {
publicPath: 'http://localhost:8080/assets',
path: "./dist/js",
filename: "[name].js"
},
module: {
loaders: [
{
test: /\.css$/,
loader: 'style!css'
},
{
test: /\.js$/,
exclude: /node_modules/,
loaders: ['react-hot','babel?presets[]=es2015&presets[]=react&plugins[]=babel-plugin-transform-object-rest-spread'],
include: path.join(__dirname, 'src')
}
]
},
resolve: {
root: path.resolve(__dirname, 'src'),
extensions: ['', '.js', '.jsx', '.css'],
alias: {
}
},
devtool: isDev ? 'cheap-module-eval-source-map' : 'source-map',
plugins: (() => {
return isDev ? [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('dev')
}
})
] : [
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
},
comments: false
}),
new webpack.optimize.OccurenceOrderPlugin(true),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
})
];
})()
};