-
Notifications
You must be signed in to change notification settings - Fork 92
/
rollup.config.js
51 lines (48 loc) · 1.16 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
import commonJs from '@rollup/plugin-commonjs'
import replace from '@rollup/plugin-replace'
import resolve from '@rollup/plugin-node-resolve'
import terser from '@rollup/plugin-terser'
const ecma = 2019
const nodeEnv = '"production"'
const config = {
output: {
compact: true,
format: 'es',
inlineDynamicImports: true
},
plugins: [
resolve({browser: true, preferBuiltins: false}),
commonJs(),
replace({
'process.env.NODE_ENV': nodeEnv,
'process?.env?.NODE_ENV': nodeEnv,
preventAssignment: true
}),
terser({
compress: {
ecma,
drop_console: ['log', 'info'],
keep_fargs: false,
module: true,
toplevel: true,
unsafe: true,
unsafe_arrows: true,
unsafe_methods: true,
unsafe_proto: true,
unsafe_symbols: true
},
format: {comments: false, ecma},
mangle: {module: true, toplevel: true}
})
]
}
export default ['firebase', 'ipfs', 'mqtt', 'nostr', 'supabase', 'torrent'].map(
name => ({
...config,
input: `src/${name}.js`,
output: {
...config.output,
file: `dist/trystero-${name}.min.js`
}
})
)