Maybe include your "add it" and "the library turned into undefined" code as a minimum example?
So people can actually check your assumptions and actions and match it against the lib.
Maybe include your "add it" and "the library turned into undefined" code as a minimum example?
So people can actually check your assumptions and actions and match it against the lib.
That js file certainly doesn't look like a normal module to me that I would expect when importing a module.
But I'm not too familiar with the JS ecosystem to the point where I know what that dynamic Object.defineProperty(exports, "__esModule"
magic does or how it's supposed to be used.
But I can see why the import would result in undefined.
With my first search of LemmyHttp I land on https://join-lemmy.org/api/classes/LemmyHttp.html, which says Defined in src/http.ts:153
. Have you considered importing http.js
? Looking at the http.js
on the CDN I can at least see the LemmyHttp class type you seem to try to import.
hmmm... okay!
exports not defined...
given how dynamic creation it looks maybe it has to be executed/included rather than imported and then the class is available?
With all that magic, and looking at https://join-lemmy.org/api/index.html if you're not using pnpm I would give up on that lib.
try opening that cdn link you sent in a browser. it'll open a directory listing for the package. you can see some examples of what urls to use on the main jsdelivr page.
I imagine the url you want is probably something like https://cdn.jsdelivr.net/npm/lemmy-js-client@0.20.0-image-api-rework.8/dist/index.js (note the extra path on the end and also a specific pinned version instead of latest so new versions don't break things)
i already use what urls!