-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
72 lines (71 loc) · 1.5 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
67
68
69
70
71
72
var webpack = require('webpack');
var hotMiddlewareScript = 'webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000&reload=true';
// required for Promise bug in the sass loaders : https://github.com/webpack/css-loader/issues/145
require('es6-promise').polyfill();
var entryFiles = [hotMiddlewareScript, './main.js'];
var plugins = [
new webpack.IgnorePlugin(/vertx/),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
];
if (process.env['NODE_ENV'] == 'production') {
entryFiles = './main.js';
plugins = [
new webpack.IgnorePlugin(/vertx/),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
]
}
module.exports = {
context: __dirname + '/src',
entry: entryFiles,
output: {
path: __dirname + '/build',
publicPath: '/',
filename: 'main.js'
},
devtool: 'source-map',
stats: {
colors: true,
modules: true,
reasons: true
},
resolve: {
alias: {},
modulesDirectories: [
'node_modules'
],
},
module: {
loaders: [
{
test: /\.js?$/,
loader: 'babel?presets[]=es2015',
exclude: /node_modules/
},
{
test: /\.scss$/,
loader: 'style!css!sass'
},
{
test: /\.css$/,
loader: 'style-loader!css-loader'
},
{
test: /\.json$/,
loader: 'json'
},
{
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
loader: 'url-loader?limit=100000'
}
]
},
plugins: plugins
}