-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.dev.config.js
More file actions
38 lines (35 loc) · 1.06 KB
/
webpack.dev.config.js
File metadata and controls
38 lines (35 loc) · 1.06 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
var webpack = require('webpack');
var path = require('path');
var node_modules_dir = path.resolve(__dirname, 'node_modules');
var publicPath = 'http://127.0.0.1:3000/';
var hotMiddlewareScript = 'webpack-hot-middleware/client?reload=true'; //加载热跟新中间件
var config = {
entry: [ hotMiddlewareScript, './frontend/index.js'], //使用热更新功能
output: {
path: path.resolve(__dirname, './public/'),
filename: 'bundle.js',
publicPath: publicPath
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader?presets[]=es2015&presets[]=react'
},
{
test: /\.css$/,
// exclude: /node_modules/,
include: /node_modules/,
loaders: ['style-loader', 'css-loader'],
}
]
},
/* 创建热更新热加载组件 */
plugins: [
// new webpack.optimize.OccurenceOrderPlugin(), //用webpack1.0版本时才需要
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin()
]
};
module.exports = config;