-
Notifications
You must be signed in to change notification settings - Fork 42
/
rollup.config.js
48 lines (45 loc) · 1.03 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
import terser from '@rollup/plugin-terser';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import bundleSize from 'rollup-plugin-bundle-size';
import virtual from '@rollup/plugin-virtual';
const pkg = require('./package.json');
const plugins = [
virtual({
crypto: `export function createHash() { throw Error('crypto.createHash is not supported in browser.'); }; export function sign() { throw Error('crypto.sign is not supported in browser.'); };`,
}),
bundleSize(),
resolve({
browser: true
}),
json(),
commonjs(),
terser({
keep_fnames: true
}),
]
export default [{
input: './lib/index.js',
output: [
{
file: pkg.browser,
format: 'umd',
name: 'eBayApi',
exports: 'default',
sourcemap: false,
},
],
plugins
}, {
input: './dist/eBayApi.js',
output: [
{
file: pkg['browser:esm'],
format: 'esm',
exports: 'named'
},
],
context: 'window',
plugins
}]