How to get `@inrupt/solid-client` to work in the browser?

Hi! I’m trying to get some of the @inrupt client libraries to work in the browser, without the need for a webpack build step. The idea is for developers to just include the code from a CDN.

I’ve had no issues with @inrupt/solid-client-authn-browser.

The static include from the bundled JS works:

<script src=""></script>
  const session = solidClientAuthentication.getDefaultSession()

The dynamic include as module also works perfectly:

<script type="module">
  import { getDefaultSession } from ''
  const session = getDefaultSession()

However, now I am trying to get @inrupt/solid-client to work and I am running into issues.

My issues:

  1. There doesn’t seem to be a bundled version (to statically load through a CDN). Is there one and am I just not seeing it? Or is no browser bundle available?

  2. When trying to load the library dynamically as a module, I get a "@rdfjs/data-model" no dependency version info found error. This seems to be easy to fix (I’ve opened an issue at the inrupt/solid-client-js repo). But when the dependency is resolved I get a Uncaught (in promise) TypeError: n3 is null error.

I’m beginning to run out of things to try… Does anyone have any ideas how I can get @inrupt/solid-client to work in the browser?

1 Like

solid-client doesn’t provide its own browser build, but bundles published modules so you could try that:

n3, one of its dependencies, unfortunately does some weird stuff that requires a horrible workaround in solid-client that I can imagine interferes with dynamic imports/skypack, so hopefully the unpkg version works for you.

1 Like

Yeah, I ran across the loadN3 function in inrupt/solid-client-js. I was afraid it might be related to my issues.

I’ve tried compiling my own bundle for the browser, but that opens a whole new typescript- and webpack-config related can of worms.

Sadly, the bundled JS code from a CDN also does not seem to be meant for the browser…

async function loadN3() {
    // ... see
    const n3Module = await Promise.resolve().then(function () { 
        return _interopNamespace(require('n3')); 
    if (typeof n3Module.default !== "undefined") {
        return n3Module.default;
    return n3Module;

When I try to load it I get the (by now familiar):

Uncaught ReferenceError: exports is not defined

or, when exports is defined:

Uncaught ReferenceError: require is not defined

1 Like

I ended up not using the library and doing the fetching and parsing myself. :disappointed:

1 Like

@Potherca the easyest way i’ve found is to use vuejs components for all my apps,

videos in french but you could have english subtitles :

then you can create a Login.vue component game-sync/Login.vue at main · scenaristeur/game-sync · GitHub

with functions stored in /plugins game-sync/solid-sync.js at cff91b26f459005d274045c2227c6fb2a758c850 · scenaristeur/game-sync · GitHub

and you can reuse your component in many apps
like booklice
or game-sync

you can build your app and host it for free on github pages (gh-pages branch)

If you need more info, let me know

1 Like