Replies: 3 comments 3 replies
-
In tsconfig.app.json under the compilerOptions, add just add "node" to types, e.g. like so /* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": ["node"]
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
]
} |
Beta Was this translation helpful? Give feedback.
-
That worked - thanks! I now get another jose import error, which I assume is caused by importing SignJWT from the wrong place or, again, missing configuration of the angular/ts compile system. (I did find this issue where you're talking about lack of support for the way you bundle this package: #143 - curious if it's related to the IDE not able to suggest the correct import?)
On my current setup (VSCode on Windows; jose is NOT installed, just the jose-browser-runtime), I was not getting any useful suggestion by the IDE where to import SignJWT from, so I manually imported from the location where the error is. This is my code:
getBytes is:
Two questions:
|
Beta Was this translation helpful? Give feedback.
-
I'm done waiting for these ecosystems to catch up. jose v4.x will be coming out today/tomorrow with only top level named exports that solve all these tools' problems. |
Beta Was this translation helpful? Give feedback.
-
I was trying something quick and needed to create a JWT from scratch in javascript, in an existing Angular app in the browser.
I was drawn to this library because it claims it doesn't have any dependencies. Initially
I did npm i jose. Later I tried with the browser runtime jose-browser-runtime but in both cases I got a "transpile time" error: Cannot find module 'crypto'
Do I need to install or update any typings (we're currently using "@types/node": "^14.17.5"? Where is the crypto imported from?
Beta Was this translation helpful? Give feedback.
All reactions