-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathrollup.config.js
103 lines (96 loc) · 2.21 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// import globals from 'rollup-plugin-node-globals'
import terser from '@rollup/plugin-terser'
import typescript from '@rollup/plugin-typescript';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
const PROD = !!process.env.CI
console.log(`production: ${PROD}`)
const plugins = [
typescript({}),
nodeResolve({
browser: true,
preferBuiltins: false,
}),
commonjs({
ignoreGlobal: true,
include: [/node_modules/],
namedExports: {
'js-sha3': [
'keccak_224',
'keccak224',
'keccak_256',
'keccak256',
'keccak_384',
'keccak384',
'keccak_512',
'keccak512',
'sha3_224',
'sha3_256',
'sha3_384',
'sha3_512',
'shake_128',
'shake128',
'shake_256',
'shake256',
'cshake_128',
'cshake128',
'cshake_256',
'cshake256',
'kmac_128',
'kmac128',
'kmac_256',
'kmac256',
],
utf8: ['encode', 'decode'],
'bignumber.js': ['BigNumber'],
// 'crypto-js': ['enc'],
react: ['Children', 'Component', 'PropTypes', 'createElement', 'useEffect', 'useState', 'useRef'],
'node_modules/secp256k1/elliptic.js': [
'privateKeyVerify',
'privateKeyNegate',
'privateKeyTweakAdd',
'privateKeyTweakMul',
'publicKeyVerify',
'publicKeyCreate',
'publicKeyConvert',
'publicKeyNegate',
'publicKeyCombine',
'publicKeyTweakAdd',
'publicKeyTweakMul',
'signatureNormalize',
'ecdsaSign',
'ecdsaVerify',
'ecdsaRecover',
'ecdh',
],
},
}),
PROD && terser({}),
// globals({}),
]
const banner = `/*! eth-connect ${JSON.stringify(
{
date: new Date().toISOString(),
commit: process.env.GITHUB_SHA || 'HEAD',
ref: process.env.GITHUB_REF || '?',
},
null,
2
)} */`
export default {
input: './src/index.ts',
context: 'globalThis',
plugins,
output: [
{
file: './dist/eth-connect.js',
format: 'umd',
name: 'ethconnect',
sourcemap: true,
banner,
amd: {
id: 'eth-connect',
},
}
],
}