Skip to content

Commit

Permalink
Update vite build config
Browse files Browse the repository at this point in the history
  • Loading branch information
nazarhussain committed Apr 18, 2024
1 parent d2a2b4f commit 62e3111
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/light-client/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
import path from "node:path";
import fs from "node:fs/promises";
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.browser.ts"}),
defineConfig({
plugins: [
dts({
entryRoot: "src",
// It would be better to rollup all types into one file, But the current package.json.types field
// is pointing to other file that conflict with the entry file for bundle. If we decide to use one
// entry file for both package and bundle then this issue could be resolved
//
rollupTypes: false,
bundledPackages: ["@lodestar/*", "@chainsafe/*"],
exclude: ["test/**/*", "*.config.ts"],
async afterBuild() {
await fs.rename(
path.join(import.meta.dirname, "dist", "index.browser.d.ts"),
path.join(import.meta.dirname, "dist", "lightclient.min.d.mts")
);
},
}),
],
build: {
rollupOptions: {
output: {
Expand Down

0 comments on commit 62e3111

Please sign in to comment.