forked from foliojs/unicode-properties
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
68 lines (59 loc) · 1.31 KB
/
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
58
59
60
61
62
63
64
65
66
67
68
import babel from 'rollup-plugin-babel'
import json from 'rollup-plugin-json';
import { dependencies } from './package.json'
const cjs = {
format: 'cjs',
sourcemap: true,
interop: false
}
const esm = {
format: 'es',
sourcemap: true
}
const getCJS = override => Object.assign({}, cjs, override)
const getESM = override => Object.assign({}, esm, override)
const configBase = {
plugins: [
json({compact: true}),
babel({
presets: [
[
'@babel/preset-env',
{
modules: false,
targets: {
node: '8.11',
browsers: [
'Firefox 57',
'Chrome 60',
'iOS 10',
'Safari 10'
]
}
}
]
]
})
]
}
const nodeConfig = Object.assign({}, configBase, {
input: './node.js',
output: [
getESM({ file: './unicode-properties.es.js' }),
getCJS({ file: './unicode-properties.cjs.js' }),
],
external: Object.keys(dependencies).concat([
'fs'
])
});
const browserConfig = Object.assign({}, configBase, {
input: './browser.js',
output: [
getESM({ file: './unicode-properties.browser.es.js' }),
getCJS({ file: './unicode-properties.browser.cjs.js' }),
]
});
export default [
nodeConfig,
browserConfig
]