-
-
Notifications
You must be signed in to change notification settings - Fork 332
/
Copy pathvite.config.ts
44 lines (42 loc) · 1.23 KB
/
vite.config.ts
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
import path from "node:path";
import fs from "node:fs";
import {defineConfig, mergeConfig} from "vite";
import dts from "vite-plugin-dts";
import {getBaseViteConfig} from "../../vite.base.config.js";
import pkgJSON from "./package.json";
export default mergeConfig(
getBaseViteConfig(pkgJSON, {libName: "LightClient", entry: "src/index.ts"}),
defineConfig({
plugins: [
dts({
rollupTypes: true,
bundledPackages: ["@lodestar/*", "@chainsafe/persistent-merkle-tree", "@chainsafe/bls", "@chainsafe/ssz"],
afterBuild() {
fs.renameSync(
path.join(import.meta.dirname, "dist", "index.d.ts"),
path.join(import.meta.dirname, "dist", "lightclient.min.d.mts")
);
},
}),
],
build: {
rollupOptions: {
output: {
footer: `
globalThis.lodestar = globalThis.lodestar === undefined ? {} : globalThis.lodestar;
globalThis.lodestar.lightclient = {
Lightclient,
LightclientEvent,
RunStatusCode,
upgradeLightClientFinalityUpdate,
upgradeLightClientOptimisticUpdate,
utils,
transport,
validation
};
`,
},
},
},
})
);