Skip to content

Commit

Permalink
Add the default export to bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
nazarhussain committed Apr 19, 2024
1 parent ba5886a commit 2451dc1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
7 changes: 0 additions & 7 deletions packages/light-client/src/index.browser.ts

This file was deleted.

5 changes: 5 additions & 0 deletions packages/light-client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,3 +318,8 @@ export class Lightclient {
this.emitter.emit(LightclientEvent.statusChange, this.runStatus.code);
}
}

// To export these name spaces to the bundle JS
export * as utils from "./utils.js";
export * as validation from "./validation.js";
export * as transport from "./transport.js";
2 changes: 2 additions & 0 deletions packages/light-client/src/transport.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// This file exists to have proper namespace for the web bundle
export * from "./transport/index.js";
2 changes: 2 additions & 0 deletions packages/light-client/src/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// This file exists to have proper namespace for the web bundle
export * from "./utils/index.js";
6 changes: 3 additions & 3 deletions packages/light-client/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {getBaseViteConfig} from "../../vite.base.config.js";
import pkgJSON from "./package.json";

export default mergeConfig(
getBaseViteConfig(pkgJSON, {libName: "LightClient", entry: "src/index.browser.ts"}),
getBaseViteConfig(pkgJSON, {libName: "LightClient", entry: "src/index.ts"}),
defineConfig({
build: {
rollupOptions: {
Expand All @@ -17,8 +17,8 @@ export default mergeConfig(
RunStatusCode,
upgradeLightClientFinalityUpdate,
upgradeLightClientOptimisticUpdate,
utils: index$1,
transport: index,
utils,
transport,
validation
};
`,
Expand Down

0 comments on commit 2451dc1

Please sign in to comment.