earthstar-project / earthstar

Storage for private, distributed, offline-first applications.
https://earthstar-project.org
GNU Lesser General Public License v3.0
637 stars 20 forks source link

ReplicaDriverWeb not accessible from all environments #310

Closed keks closed 1 year ago

keks commented 1 year ago

What's the problem you want solved?

I noticed that ReplicaDriverWeb is not accessible from my setup. It also doesn't show up in the API docs.

I use npm with webpack. It's very small, no fancy build scripts. I import earthstar using

import * as Earthstar from "earthstar";

and that works and most functionality is there, but ReplicaDriverWeb isn't.

When using it from a simple js file with type=module and the cdn import it worked fine. No idea what the cause is, I don't know JS/TS tooling very well.

Is there a solution you'd like to recommend?

Sorry, no.

keks commented 1 year ago

Oh and I depend on version ^10.0.1

sgwilym commented 1 year ago

Hi @keks! In the NPM distribution some exports have been moved to earthstar/browser and earthstar/node. I realise the docs don't mention this, so apologies!

import * as Earthstar from "earthstar";
import { ReplicaDriverWeb } from "earthstar/browser"; 

Let me know if that helps.

sgwilym commented 1 year ago

You're right about ReplicaDriverWeb being missing from the API docs. It's because those docs are generated from the Deno entrypoint, which doesn't export it. Seems I need to add links for the browser and Node entrypoints to the website too.

sgwilym commented 1 year ago

As the README has been updated and the website now lists APIs for all environments on the website, I'd like to think it'd be harder for some to get into the same situation as you did.