-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
76 lines (73 loc) · 2.15 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
73
74
75
76
'use strict';
var webpack = require('webpack');
var DashboardPlugin = require('webpack-dashboard/plugin');
var autoprefixer = require('autoprefixer');
const isProduction = process.env.NODE_ENV === 'production';
var config = {
entry: [
'core-js/fn/promise',
'./app/index.js',
],
output: {
path: __dirname + '/build',
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /\.jsx?$/,
loaders: ['babel-loader', 'eslint-loader'],
exclude: /node_modules/
},
{
test: /\.scss$/,
loaders: [
'style-loader',
{
loader: 'css-loader',
options: {
importLoaders: 1,
sourceMap: isProduction ? false : true,
}
},
'postcss-loader',
'resolve-url-loader',
{
loader: 'sass-loader',
options: {
sourceMap: true,
outputStyle: isProduction ? 'compressed' : 'expanded',
}
},
]
},
{
test: /\.(svg|eot|ttf|woff|woff2)$/,
loader: 'url-loader',
options: {
limit: 1000,
name: 'fonts/[name].[ext]'
}
},
]
},
devServer: {
contentBase: __dirname + '/build',
hot: true,
host: '0.0.0.0',
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new DashboardPlugin(),
],
// source map in ext file in production and cheap fast source maps in dev
devtool: isProduction ? 'hidden-source-map' : 'eval-source-map',
// do not continue on error
bail: true,
};
if (process.env.NODE_ENV === 'production') {
// do not use devServer or dev plugins
delete config.devServer;
config.plugins = [];
}
module.exports = config;