forked from blocknative/web3-onboard
-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
rollup.config.js
108 lines (103 loc) · 2.44 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
104
105
106
107
108
import svelte from "rollup-plugin-svelte"
import resolve from "rollup-plugin-node-resolve"
import json from "rollup-plugin-json"
import image from "rollup-plugin-img"
import commonjs from "rollup-plugin-commonjs"
import globals from "rollup-plugin-node-globals"
import builtins from "@joseph184/rollup-plugin-node-builtins"
import { terser } from "rollup-plugin-terser"
import typescript from "rollup-plugin-typescript2"
import {
preprocess,
createEnv,
readConfigFile
} from "@pyoner/svelte-ts-preprocess"
const env = createEnv()
const compilerOptions = readConfigFile(env)
const opts = {
env,
compilerOptions: {
...compilerOptions,
allowNonTsExtensions: true
}
}
export default [
{
input: "src/onboard.ts",
output: {
sourcemap: true,
format: "umd",
name: "onboard",
file: "dist/bnc-onboard.js"
},
moduleContext: id => {
const thisAsWindowForModules = [
"node_modules/intl-messageformat/lib/core.js",
"node_modules/intl-messageformat/lib/compiler.js"
]
if (thisAsWindowForModules.some(id_ => id.trimRight().endsWith(id_))) {
return "window"
}
},
plugins: [
image(),
json(),
svelte({
preprocess: preprocess(opts)
}),
resolve({
browser: true,
preferBuiltins: true,
dedupe: importee =>
importee === "svelte" || importee.startsWith("svelte/")
}),
commonjs(),
globals(),
builtins(),
typescript(),
terser()
]
},
{
input: "src/onboard.ts",
output: {
sourcemap: true,
format: "es",
file: "dist/bnc-onboard.es5.js"
},
moduleContext: id => {
const thisAsWindowForModules = [
"node_modules/intl-messageformat/lib/core.js",
"node_modules/intl-messageformat/lib/compiler.js"
]
if (thisAsWindowForModules.some(id_ => id.trimRight().endsWith(id_))) {
return "window"
}
},
plugins: [
json(),
image(),
svelte({
preprocess: preprocess(opts)
}),
resolve({
browser: true,
dedupe: importee =>
importee === "svelte" || importee.startsWith("svelte/")
}),
commonjs(),
typescript()
],
external: [
"bowser",
"bnc-sdk",
"bignumber.js",
"promise-cancelable",
"@portis/web3",
"@walletconnect/web3-provider",
"fortmatic",
"squarelink",
"authereum"
]
}
]