-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
57 lines (51 loc) · 975 Bytes
/
rollup.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
import fs from 'fs'
import notify from 'rollup-plugin-notify'
var pkg = JSON.parse(fs.readFileSync('package.json').toString())
var nodeCoreModules = require('repl')._builtinLibs
var external = [...nodeCoreModules, ...Object.keys(pkg.dependencies || {})]
var globals = objectFromArray(external)
var format = 'umd'
var name = 'uwp-node'
var plugins = [
notify()
]
export default [
{
external,
input: 'src/index.mjs',
output: {
file: `index.js`,
format, name, globals,
},
plugins,
}, {
external,
input: 'src/uwp.mjs',
output: {
file: `uwp.js`,
format, name, globals,
},
plugins,
}, {
external,
input: 'src/node.mjs',
output: {
file: `node.js`,
format, name, globals,
},
plugins,
}, {
external,
input: 'src/util.mjs',
output: {
file: `util.js`,
format, name, globals,
},
plugins,
}
]
function objectFromArray(arr) {
var obj = {}
arr.forEach(moduleName => obj[moduleName] = moduleName)
return obj
}