Hi, I am trying to use the npm jose library "jose": "^5.6.3": https://github.com/panva/jose/blob/main/src/index.ts in CLJS code. Can anyone tell me how to require the namespace correctly and use it? I am requiring ["jose" :as jose] and tried (.decodeJwt jose jwt) and (jose/decodeJwt jwt) but I get the error ExceptionInfo: could not find string alias for "jose" from myapp.core.
What is your build tool? Also make sure you it's actually in your node_modules
the library uses the export * as X syntax that is not supported by google closure compiler so neither is shadowcljs
You could use the :js-options {:js-provider :external} option in the shadowcljs config as a workaround, altough I don't exactly know all the implications for the others packages https://shadow-cljs.github.io/docs/UsersGuide.html#js-provider
ho actually there's an issue for this exact same library: https://github.com/thheller/shadow-cljs/issues/1190 referencing https://github.com/google/closure-compiler/issues/4177
@aciep Shadow-cljs and file exists under node_modules after I ran npm i.
@schad.alexis Thanks for digging into it.
I reported the issue to the Jose repo, and they have released a fix: https://github.com/panva/jose/discussions/832 - however, I am still running into the same could not find string alias... error.
The fix commit is here: https://github.com/panva/jose/commit/6303d98efba00c9a3f8f3e814c85ac6e6944b11c - I see that export * is gone, but import * has been added.
Pinging @thheller for any ^ input.
it should work now, are you sure you have upgraded the package?
The import ["jose" :as jose] is the right one
You can double check looking at node_modules/jose/dist/webapi/index.js to see if there's still export * as or not
I did upgrade the package version, and refetched node_modules afresh. But still the same error. I will probably try out an independent project with just this one dependency.
It was an issue with my setup - it's working for me.
well done getting the issue fixed 🙂