-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
71 lines (68 loc) · 2.66 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
59
60
61
62
63
64
65
66
67
68
69
70
71
var path = require('path');
var webpack = require('webpack');
// var hot = 'webpack/hot/dev-server';
// module.exports = function(config) {
// return {
// // watch: true,
// //页面入口
// entry: config.script.entry,
// //出口文件输出配置
// output: {
// path: config.dest, //js位置
// publicPath: config.dest, //web打包的资源地址
// filename: config.script.name
// },
// module: { //加载器
// loaders: [{
// test: /\.(js|jsx)?$/, // 用正则来匹配文件路径,这段意思是匹配 js 或者 jsx
// include: path.join(__dirname, 'src'),
// loaders: ['babel']
// }]
// }
// }
// }
var config = {
plugins: [new webpack.optimize.MinChunkSizePlugin({
compress: {
warnings: false
}
})
],
devtool: false,
// entry: {
// index: [path.resolve(__dirname, 'src/examples/index.js')],
// domIndex: [path.resolve(__dirname, 'src/examples/domIndex.js')],
// domUtil: [path.resolve(__dirname, 'src/examples/domUtil.js')],
// domCore: [path.resolve(__dirname, 'src/examples/domCore.js')],
// domManipulationData: [path.resolve(__dirname, 'src/examples/domManipulationData.js')],
// domWrapData: [path.resolve(__dirname, 'src/examples/domWrapData.js')],
// domTravesing: [path.resolve(__dirname, 'src/examples/domTravesing.js')],
// domAttr: [path.resolve(__dirname, 'src/examples/domAttr.js')],
// domCss: [path.resolve(__dirname, 'src/examples/domCss.js')],
// domOffset: [path.resolve(__dirname, 'src/examples/domOffset.js')],
// domEvent: [path.resolve(__dirname, 'src/examples/domEvent.js')],
// domUiPosition: [path.resolve(__dirname, 'src/examples/domUiPosition.js')],
// domAnimate: [path.resolve(__dirname, 'src/examples/domAnimate.js')]
// },
entry: {//umd
leoDom: [path.resolve(__dirname, 'src/dom/index.js')]
},
// output: {
// path: path.resolve(__dirname, 'dist'),
// filename: '[name].js' // 注意我们使用了变量
// },
output: {//umd
path: path.resolve(__dirname, 'umd'),
filename: '[name].js', // 注意我们使用了变量
library: ["[name]"],
libraryTarget: "umd"
},
module: {
loaders: [{
test: /\.(js|jsx)?$/, // 用正则来匹配文件路径,这段意思是匹配 js 或者 jsx
include: path.join(__dirname, 'src'),
loaders: ['babel?optional[]=runtime']
}]
}
};
module.exports = config;