-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
58 lines (58 loc) · 1.3 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
54
55
56
57
58
var webpack = require('webpack')
var hotEntry = 'webpack-hot-middleware/client?http://localhost:5130'
var path = require('path')
var entryPath = path.resolve(__dirname, './web/lists')
var distAbsolutePath = path.resolve(__dirname, './dist')
var entryArray = [
{
name: 'resizer',
path: entryPath+ '/resizer/index',
router: 'resizer'
},
{
name: 'zifuhua',
path: entryPath+ '/zifuhua/index',
router: 'zifuhua'
}
]
module.exports = {
entry: (function () {
var map = {}
entryArray.forEach(function (item) {
map[ item.name ] = [ hotEntry, item.path + '.js' ]
})
console.log(map)
return map
})() ,
output: {
path: distAbsolutePath,
filename: "[name].bundle.js",
publicPath: '/dist' // web地址,不能用path解析
},
// watch: true,
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015', 'react']
}
},
{
test: /\.css$/,
exclude: /node_modules/,
loader: "style!css"
},
]
},
resolve: {
extensions: ['', '.js', '.jsx', '.css']
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
]
}