-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.babel.js
43 lines (42 loc) · 1.1 KB
/
webpack.config.babel.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
// const ExtractTextPlugin = require('extract-text-webpack-plugin')
const webpackValidator = require('webpack-validator')
const {resolve} = require('path')
const {getIfUtils} = require('webpack-config-utils')
module.exports = env => {
const {ifProd, ifNotProd} = getIfUtils(env)
const config = webpackValidator({
context: resolve('src'),
entry: './index.js',
output: {
filename: 'bundle.js',
path: resolve('dist'),
publicPath: '/dist/',
pathinfo: ifNotProd()
},
devtool: ifProd('source-map', 'eval'),
module: {
loaders: [
{ test: /\.js$/, loaders: ['babel-loader'], exclude: /node_modules/ },
{ test: /\.css$/, loader: 'style-loader!css-loader?modules' }
]
},
devServer: {
publicPath: '/dist/',
historyApiFallback: true,
hot: true,
inline: true,
proxy: {
'/': {
bypass: function (req, res, proxyOptions) {
return '/public/index.html'
}
}
}
}
})
if (env.debug) {
console.log(config)
debugger // eslint-disable-line
}
return config
}