forked from freeCodeCamp/pantry-for-good
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.dev.js
63 lines (61 loc) · 1.47 KB
/
webpack.config.dev.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
const webpack = require('webpack')
const merge = require('webpack-merge')
const {resolve} = require('path')
const autoprefixer = require('autoprefixer')
const common = require('./webpack.config')
module.exports = merge(common, {
entry: {
app: [
'react-hot-loader/patch',
'webpack-dev-server/client?http://localhost:8080',
'webpack/hot/only-dev-server',
'whatwg-fetch',
resolve(__dirname, 'client', 'app.js')
]
},
output: {
path: resolve(__dirname, 'dist', 'client'),
filename: '[name].js',
// http://stackoverflow.com/questions/34133808/webpack-ots-parsing-error-loading-fonts/34133809#34133809
publicPath: 'http://localhost:8080/'
},
module: {
rules: [
{
test: /\.css$/,
use: [
'style-loader',
'css-loader?sourceMap',
{loader: 'postcss-loader', options: {plugins: () => [autoprefixer]}}
]
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
}
})
],
devServer: {
hot: true,
stats: {
colors: true,
chunks: false
},
proxy: {
'/api/*': {
target: 'http://localhost:3000',
proxyTimeout: 3000
}
},
contentBase: resolve(__dirname, 'assets'),
port: 8080,
historyApiFallback: {
index: 'http://localhost:8080/'
}
},
devtool: 'eval'
})