-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.dev.js
47 lines (45 loc) · 1.17 KB
/
webpack.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
const webpack = require('webpack');
const eslintFormatter = require('react-dev-utils/eslintFormatter');
const common = require('./webpack.common.js');
common.entry.push('webpack-hot-middleware/client?reload=true');
common.devtool = 'inline-source-map';
common.module.rules = [
{
test: /\.(js|jsx)$/,
enforce: 'pre',
use: [
{
options: {
formatter: eslintFormatter,
},
loader: require.resolve('eslint-loader'),
},
],
},
...common.module.rules,
];
common.devServer = {
historyApiFallback: true,
hot: true,
inline: true,
proxy: {
'/socket': {
target: 'http://wire.andela.com:3000',
ws: true,
},
},
};
common.plugins = [
...common.plugins,
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
API_URL: JSON.stringify(process.env.API_URL),
ANDELA_API_BASE_URL: JSON.stringify(process.env.ANDELA_API_BASE_URL),
BASE_URL: JSON.stringify(process.env.BASE_URL),
},
}),
new webpack.NamedModulesPlugin(), // displays the path of the module when HMR is enabled.
new webpack.HotModuleReplacementPlugin(),
];
module.exports = common;