Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(network,std-client): make nodejs compatible #919

Closed
wants to merge 2 commits into from
Closed

Conversation

alvrs
Copy link
Member

@alvrs alvrs commented May 19, 2023

NOTE: some of these fixes feel very hacky and I'm not sure we should merge this PR.

If you're a hacker at the Autonomous World hackathon and need to run the network sync in nodejs, here is how you can use this branch to make it work:

  1. Clone this repository, checkout the alvrs/nodejs branch
  2. Run pnpm install && pnpm build at the root
  3. Run pnpm mud set-version --link <relative/path/to/mud/root> from your nodejs project root to link your project to your local MUD setup
  4. Run pnpm install at your nodejs project root to install the local MUD packages

Example to changes in a project to get this running: oostvoort/imaigine#1

@@ -1,6 +1,9 @@
import { arrayToIterator, deferred, mergeIterators, transformIterator } from "@latticexyz/utils";
import fakeIndexedDb from "fake-indexeddb";
Copy link
Member

@holic holic May 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if there's a way to update the methods below to use an async import so we don't have to import this into browser bundles.

const indexedDB = typeof self !== 'undefined' && typeof self.indexedDB !== 'undefined'
  ? self.indexedDB
  : await import('fake-indexeddb');

@alvrs
Copy link
Member Author

alvrs commented Jun 16, 2023

closing this, as it mostly served as an example for folks urgently needing node support during the eth global hackathon. We're working on a new sync library with proper node support in #1033 (+ followup PRs)

@alvrs alvrs closed this Jun 16, 2023
@holic holic deleted the alvrs/nodejs branch June 23, 2023 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants