-
Notifications
You must be signed in to change notification settings - Fork 8
/
rollup.config.js
executable file
·56 lines (55 loc) · 1.35 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
import json from 'rollup-plugin-json';
import pkg from './package.json';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import replace from 'rollup-plugin-replace';
import commonjs from '@rollup/plugin-commonjs';
import nodePolyfills from 'rollup-plugin-node-polyfills';
export default [
{
input: 'lib/src/alks.js',
output: {
file: pkg.browser,
format: 'umd',
name: 'alks',
exports: 'named',
// without this line, karma tests complain that `global` isn't defined
intro: 'var global = global || window || this;',
// without this, you have to add `.default` to your require(...) like `const alks = require('alks').default`
outro: 'Object.assign(exports, alks);'
},
plugins: [
json(),
replace({'process.browser': true}),
commonjs(),
nodePolyfills(),
nodeResolve(),
]
},
{
input: 'lib/src/alks.js',
output: {
file: pkg.main,
format: 'cjs',
exports: 'named',
},
plugins: [
replace({'process.browser': false}),
nodeResolve({preferBuiltins: true}),
json(),
]
},
{
input: 'lib/src/alks.js',
output: {
file: pkg.module,
format: 'es',
exports: 'named',
},
plugins: [
replace({'process.browser': true}),
nodePolyfills(),
nodeResolve(),
json(),
]
}
]