Reputation: 1703
I'm importing object to a .ts
file but it is undefined
, when I do the same with require
keyword , then it is working. But I'd like to understand whats happening
const jwt = require('jsonwebtoken'); // working
import {jwt2} from 'jsonwebtoken'; // not working
Upvotes: 1
Views: 3460
Reputation: 30899
The first example is importing the entire module, while the second one is trying to import a member of the module named jwt2
, but there is no such member. To import the entire module using import
, try:
import * as jwt2 from 'jsonwebtoken';
Upvotes: 6