-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.dev.config.js
48 lines (46 loc) · 1.29 KB
/
webpack.dev.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
/**
* Created by shenlu on 17/2/27.
*/
const webpack = require('webpack');
module.exports = {
context:__dirname + "/src",
entry: {
main: "./index.js",
vendor: [
'react',
'react-dom',
'react-redux',
'react-router',
'redux',
'lodash',
'redux-saga'
]
},
output: {
path: __dirname + "/public",//打包后的文件存放的地方
filename: "bundle.js"//打包后输出文件的文件名
},
module: {
loaders: [
{test: /\.(js|jsx)$/,exclude: /node_modules/,loader: "babel"},
{test: /\.css$/,loaders: ['style-loader','css-loader']}, //这里如果是数组就必须是 loaders
{test: /\.less$/,exclude: /node_modules/,loaders: ["style-loader", "css-loader!less-loader"]},
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.bundle.js'),//打包第三方库
//打包生成css
//new ExtractTextPlugin("[name].css"),
//去除没有用的css
//new HtmlWebpackUncssPlugin(),
],
devServer: {
contentBase: './src',
hot: true,
inline: true,
secure: false,
historyApiFallback: true,
proxy: {
}
}
}