-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack-dev-server.config.js
57 lines (54 loc) · 1.2 KB
/
webpack-dev-server.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
const webpack = require('webpack');
const CLIENT_URI = process.env.CLIENT_URI || 'http://localhost:3000';
const config = {
mode: 'development',
cache: true,
// Entry points to the project
entry: {
main: [
// only- means to only hot reload for successful updates
'babel-polyfill',
'webpack-hot-middleware/client?reload=true',
'./src/app.jsx',
],
},
target: 'web',
devtool: 'eval-source-map',
resolve: {
extensions: ['.js', '.jsx'],
},
output: {
path: __dirname, // Path of output file
filename: 'app.js',
publicPath: `${CLIENT_URI}/`,
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
],
module: {
rules: [
{
test: /.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
cacheDirectory: true,
},
},
{
test: /.css$/i,
use: ['style-loader', 'css-loader'],
},
],
},
externals: {
externals: {
'react/addons': true,
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': true,
'react-addons-test-utils': 'react-dom',
},
},
};
module.exports = config;