-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.dev.config.js
More file actions
63 lines (57 loc) · 2.01 KB
/
Copy pathwebpack.dev.config.js
File metadata and controls
63 lines (57 loc) · 2.01 KB
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 path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const baseConfig = require('./webpack.common.config.js');
const devPort = 3001;
module.exports = merge(baseConfig, {
devtool: 'eval-source-map',
entry: {
bundle: [
'react-hot-loader/patch',
'webpack-dev-server/client?http://localhost:'+devPort,
'webpack/hot/only-dev-server',
path.resolve(__dirname, 'src/index.js')
]
},
output: {
path: path.resolve(__dirname, 'public'),
publicPath: '/',
filename: '[name].js',
chunkFilename: '[id].[hash:8].js'
},
devServer: {
inline: true,
port: devPort,
contentBase: path.resolve(__dirname, 'public'),
hot: true,
publicPath: '/',
historyApiFallback: true,
// proxy: {
// "**": {
// target: "http://localhost:8080/api",
// secure: false,
// prependPath: false
// }
// }
},
plugins: [
new webpack.HotModuleReplacementPlugin(), // HMR을 사용하기 위한 플러그인
new webpack.NamedModulesPlugin(), //브라우저에서 HMR 에러발생시 module name 표시
new webpack.NoEmitOnErrorsPlugin(), // console에 에러로그 찍어줌
new webpack.optimize.CommonsChunkPlugin({ // app.js에 들어갈만한 내용을 vendor로 빼주는 플러그인
name: 'vendor',
minChunks: function (module) {
// this assumes your vendor imports exist in the node_modules directory
return module.context && module.context.indexOf('node_modules') !== -1;
}
}),
new HtmlWebpackPlugin({
filename: 'index.html',
template: __dirname + '/src/index.html'
}),
new webpack.EnvironmentPlugin({
NODE_ENV: 'development'
}),
],
});