Michael Evans
02/21/2022, 8:18 PMimplementation(npm("jwt-decode","3.1.2"))
In my kotlin code:
@JsModule("jwt-decode")
@JsNonModule
external fun jwt_decode(token: String): dynamic
And what I see in the console output in my browser dev tools:
GoogleAuthComponent.kt?e0b6:35 Uncaught TypeError: $module$jwt_decode is not a function
Here is the documentation of how the js library should work in vanilla javascript:
import jwt_decode from "jwt-decode";
var token = "eyJ0eXAiO.../// jwt token";
var decoded = jwt_decode(token);
Am I missing some step? I can see the jwt-decode libary got pulled into my build node_modules directory. But it doesn't appear to be packaged up with my projects js file, and it doesn't appear to get pulled down via any other network requests from my page.
Do I need to add a script tag to pull the js file down myself? And if so, is there some path at which all the node modules are available?
Is there any more in-depth documentation than this? https://kotlinlang.org/docs/using-packages-from-npm.htmlBig Chungus
02/21/2022, 9:35 PMBig Chungus
02/21/2022, 9:35 PMturansky
02/21/2022, 9:45 PM@file:JsModule("jwt-decode")
@file:JsNonModule
@JsName("default")
external fun jwt_decode(token: String): dynamic
Big Chungus
02/21/2022, 9:47 PM@JsModule("jwt-decode")
@JsNonModule
@JsName("default")
external fun jwt_decode(token: String): dynamic