Sometimes, we want to fix Module not found: Error: Can’t resolve ‘crypto’ with TypeScript.
In this article, we’ll look at how to fix Module not found: Error: Can’t resolve ‘crypto’ with TypeScript.
How to fix Module not found: Error: Can’t resolve ‘crypto’ with TypeScript?
To fix Module not found: Error: Can’t resolve ‘crypto’ with TypeScript, w e add a reference to the crypto
library in tsconfig.json
.
For instance, we write
{
//...
"compilerOptions": {
"baseUrl": "./",
"paths": {
"crypto": ["node_modules/crypto-js"]
}
}
//...
}
to set the path to the crypto
module in the tsconfig.json
file in the compilerOptions.paths
JSON property.
Conclusion
To fix Module not found: Error: Can’t resolve ‘crypto’ with TypeScript, w e add a reference to the crypto
library in tsconfig.json
.