unable to load 3rd party library to aurelia cli

Asked By: Anonymous

I’m trying to install jwt-decode to my aurelia cli application. I’ve npm installed the library and added it to my aurelia.json file:

"dependencies": [
    ... other deps
    {
        "name": "jwt-decode",
        "path": "../node_modules/jwt-decode/lib",
        "main": "index"
    }
    ... other deps
]

When I run au build or au run everything compiles and I can see the the cli is tracing the jwt-decode package; however, when I try to include it in a file I get an error:

src/stores/auth/service.ts(4,24): error TS2307: Cannot find module 'jwt-decode'.
[22:13:04] gulp-notify: [Error running Gulp] Error: src/stores/auth/service.ts(4,24): error TS2307: Cannot find module 'jwt-decode'.
[22:13:04] TypeScript: 1 semantic error
[22:13:04] TypeScript: emit succeeded (with errors)

I’ve even tried adding it to the prepend property but it did not work. I’m also using typescript so I don’t know if that could be causing an issue.


Solution

Answered By: Anonymous

Your dependencies section in aurelia.json is correct.

This error is related to TypeScript: typing definition (.d.ts file) is missing for ‘jwt-decode’ package.

You can install it by typings install dt~jwt-decode --global --save

After that, import it as a global module: import * as jwt from 'jwt-decode';


Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen Windows 10 Lisans Office 2019 Mac Satın Al follower kaufen instagram follower kaufen porno