-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.js
53 lines (52 loc) · 1.16 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
const path = require('path');
const webpack = require('webpack');
const DotenvPlugin = require('webpack-dotenv-plugin');
module.exports = {
entry: './client/index.js',
devtool: 'eval',
output: {
path: path.join(__dirname, '/public'),
filename: 'bundle.js'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: ['react-hot-loader', 'babel-loader']
},
{
test: /\.json$/, //This is to load json as how we load js files using import. Refer Search.js
loader: 'json-loader'
},
{
test: /\.css$/,
loader: 'style-loader!css-loader'
},
{
test: /\.png$/,
loader: 'url-loader?mimetype=image/png'
}
]
},
resolve: {
extensions: ['.js', '.json']
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new DotenvPlugin({
sample: './.env',
path: './.env'
})
],
devServer: {
hot: true,
port: 8081,
proxy: {
'*': 'http://127.0.0.1:' + (process.env.PORT || 8080)
},
host: '127.0.0.1'
}
};