-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathwebpack.config.js
75 lines (74 loc) · 1.7 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
72
73
74
75
var webpack = require('webpack');
var banner =
'/*!\n' +
' * Q.js v' + require('./package').version + '\n' +
' * Inspired from vue.js\n' +
' * (c) ' + new Date().getFullYear() + ' Daniel Yang\n' +
' * Released under the MIT License.\n' +
' */\n';
var jqueryPrompt =
'/**\n' +
' * from: http://kangax.github.io/compat-table/es5\n' +
' * We can find almost all es5 features have been supported after IE9,\n' +
' * so we suggest under IE8 just use:\n' +
' * https://github.com/es-shims/es5-shim\n' +
' */\n';
var zeptoPrompt =
'/**\n' +
' * Depend on zepto & support mobile browser\n' +
' */\n';
var nativePrompt =
'/**\n' +
' * Just support modern browser\n' +
' */\n';
module.exports = {
jquery: {
output: {
filename: 'Q.js',
library: 'Q',
libraryTarget: 'umd'
},
externals: {
'jquery': {
root: 'jQuery',
amd: 'jquery',
commonjs2: 'jquery',
commonjs: 'jquery'
}
},
plugins: [
new webpack.BannerPlugin([banner, jqueryPrompt].join('\n'), { raw: true })
]
},
zepto: {
output: {
filename: 'Q.zepto.js',
library: 'Q',
libraryTarget: 'umd'
},
externals : {
'zepto': {
root: 'Zepto',
amd: 'zepto',
commonjs2: 'zepto',
commonjs: 'zepto'
}
},
plugins: [
new webpack.BannerPlugin([banner, zeptoPrompt].join('\n'), { raw: true }),
new webpack.ProvidePlugin({
Zepto: 'zepto',
})
]
},
'native': {
output: {
filename: 'Q.native.js',
library: 'Q',
libraryTarget: 'umd'
},
plugins: [
new webpack.BannerPlugin([banner, nativePrompt].join('\n'), { raw: true })
]
}
};