Open RubenVerborgh opened 5 years ago
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?
Yeah; and since it's a blank file, you probably do not need a build process at all.
:smile: good point!
Alternatively, the browser version could fall back to solid-auth-client, which would make it the solution suggested here: https://github.com/RubenVerborgh/LDflex-Comunica/issues/12#issuecomment-475296533
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.
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.)
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?
Probably the latter is safest.
OK, thanks, I'll give it a shot.
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)
Weird, this is a not directly related component.
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).