-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.js
75 lines (71 loc) · 1.77 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
69
70
71
72
73
74
75
/**
* # Sample Rollup for Fabric
*/
import babel from '@rollup/plugin-babel';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import replace from '@rollup/plugin-replace';
import css from 'rollup-plugin-import-css';
import json from '@rollup/plugin-json';
import url from '@rollup/plugin-url';
const plugins = [
resolve({
extensions: ['.js']
}),
replace({
preventAssignment: true,
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
}),
css(),
json(),
url(),
babel({
presets: ['@babel/preset-react'],
babelHelpers: 'runtime',
skipPreflightCheck: true,
exclude: '**/node_modules/**',
}),
commonjs({
include: 'node_modules/**'
})
];
function handleWarning (warning, warn) {
const { code, importer } = warning;
if (code === 'CIRCULAR_DEPENDENCY' && importer.includes('semantic-ui-react')) return;
warn(warning);
}
const builds = [
{
input: 'scripts/browser.js',
output: [
{
file: 'assets/browser.js',
format: 'iife',
name: 'PortalFeedMonitor',
globals: {
'buffer': 'buffer',
'crypto': 'crypto',
'querystring': 'querystring',
'stream': 'stream',
'url': 'url',
'punycode': 'punycode',
'zlib': 'zlib',
'events': 'events',
'net': 'net',
'tls': 'tls',
'stream': 'stream',
'lodash.merge': 'merge',
'https': 'https',
'react': 'React',
'react-dom': 'ReactDOM',
'semantic-ui-react': 'semanticUIReact',
'bip39': 'bip39',
'trezor-connect': 'TrezorConnect'
},
}
],
plugins: plugins,
onwarn: handleWarning
}
];
export default builds;