Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Ensure that the browser version is empty #1

Open
RubenVerborgh opened this issue Mar 21, 2019 · 11 comments
Open

Ensure that the browser version is empty #1

RubenVerborgh opened this issue Mar 21, 2019 · 11 comments

Comments

@RubenVerborgh
Copy link

We should ensure that solid-auth-cli is never included for the browser by using a technique such as this one: https://github.com/solid/solid-auth-client/blob/v2.3.0/package.json#L6

This avoids things like https://github.com/linkeddata/rdflib.js/pull/306/files#diff-11e9f7f953edc64ba14b0cc350ae7b9dR45 (which would be necessary again on every library, for instance, also libraries that use rdflib).

@jeff-zucker
Copy link
Owner

I see the problem and will brush up on my build fu to figure out how to solve it in solid-auth-cli so it doesn't need to be repeatedly solved elsewhere. If I'm understanding you correctly, you're suggesting I make two builds and essentially have the browser build be a blank file?

@RubenVerborgh
Copy link
Author

Yeah; and since it's a blank file, you probably do not need a build process at all.

@jeff-zucker
Copy link
Owner

😄 good point!

@RubenVerborgh
Copy link
Author

Alternatively, the browser version could fall back to solid-auth-client, which would make it the solution suggested here: LDflex/LDflex-Comunica#12 (comment)

@jeff-zucker
Copy link
Owner

That seems like a great way to go. But I wonder if it should be reversed: the wrapper would be in s-a-client so that it falls back to s-a-cli in browserless context. Downstream apps including rdflib would always depend only on s-a-client which itself would depend on s-a-cli for its browserless build. That way no downstream apps need to even know there are two libraries or have conditional requires.

@RubenVerborgh
Copy link
Author

The idea is typically that Node is main, and browser is the fallback. So I think that this is the right place. (Otherwise, solid-auth-client would expose nothing to Node, which can be problematic for those who want to transpile.)

@jeff-zucker
Copy link
Owner

Ah, OK, I have a lot to learn when it comes to build issues. So can I point the browser build directly to solid-auth-client in package.json/webpack.config or should I make a browser/index.js which requires then exports solid-auth-client?

@RubenVerborgh
Copy link
Author

Probably the latter is safest.

@jeff-zucker
Copy link
Owner

OK, thanks, I'll give it a shot.

@jeff-zucker
Copy link
Owner

I have been trying to get query-ldflex to work with solid-auth-cli and run into problems with the readme example. I've required solid-auth-cli instead of client in my local query-ldflex files and get this error when I try "await person.label". Any tips on where I should look?

(node:18077) UnhandledPromiseRejectionWarning: TypeError: iterable[Symbol.asyncIterator] is not a function
    at getFirstItem (/var/www/html/solid/t/ldflex/node_modules/ldflex/lib/iterableUtils.js:14:50)
    at /var/www/html/solid/t/ldflex/node_modules/ldflex/lib/defaultHandlers.js:52:77
    at Proxy.<anonymous> (/var/www/html/solid/t/ldflex/node_modules/ldflex/lib/promiseUtils.js:16:38)

@RubenVerborgh
Copy link
Author

Weird, this is a not directly related component.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants