-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
55 lines (48 loc) · 1.48 KB
/
gulpfile.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
const gulp = require('gulp');
const rollup = require('rollup');
const commonjs = require('rollup-plugin-commonjs');
const resolve = require('rollup-plugin-node-resolve');
const babel = require('rollup-plugin-babel');
gulp.task('build', async function() {
// const inputOptions = function(filename) {
// return {
// entry: `./lib/${filename}.js`,
// plugins: [
// commonjs(),
// resolve(),
// babel({
// exclude: 'node_modules/**' // 只编译我们的源代码
// })
// ]
// }
// }
// const outputOptions = function(filename, modulename) {
// const moduleName = modulename || filename;
// return {
// dest: `./dist/${filename}.js`,
// format: 'umd',
// moduleName,
// }
// }
// const vnodeBundle = await rollup.rollup(inputOptions('vnode'));
// await vnodeBundle.write(outputOptions('vnode', 'VNode'));
// const listDiffBundle = await rollup.rollup(inputOptions('diff'));
// await listDiffBundle.write(outputOptions('diff'));
// const virtualDOM = await rollup.rollup(inputOptions('virtual-dom'));
// await virtualDOM.write(outputOptions('virtual-dom', 'vd'));
const index = await rollup.rollup({
entry: `./index.js`,
plugins: [
commonjs(),
resolve(),
babel({
exclude: 'node_modules/**' // 只编译我们的源代码
})
]
})
await index.write({
dest: `./dist/virtual-dom.js`,
format: 'umd',
moduleName: 'virtualDOM',
})
});