Comments (3)
@sshehab1 You might find some help here for how to enable ESM packages in your project. If you using TypeScript, and want to use await import()
, try adding "moduleResolution": "Node16",
to your tsconfig compiler options.
@vitjaz Adding "moduleResolution": "Node16",
+ using await import()
seems to work for NestJS projects too.
from azure-ad-verify-token.
Same error
import in my nest guard:
import { verify, VerifyOptions } from 'azure-ad-verify-token';
error:
const azure_ad_verify_token_1 = require("azure-ad-verify-token");
^
Error [ERR_REQUIRE_ESM]: require() of ES Module C:\repo\qvant\contacts-bff\node_modules\azure-ad-verify-token\dist\index.js from C:\repo\qvant\contacts-bff\dist\auth\microsoft-bearer.guard.js not supported.
Instead change the require of index.js in C:\repo\qvant\contacts-bff\dist\auth\microsoft-bearer.guard.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (C:\repo\qvant\contacts-bff\dist\auth\microsoft-bearer.guard.js:23:33)
at Object.<anonymous> (C:\repo\qvant\contacts-bff\dist\modules\user\user.controller.js:17:34)
at Object.<anonymous> (C:\repo\qvant\contacts-bff\dist\modules\user\user.module.js:12:27)
at Object.<anonymous> (C:\repo\qvant\contacts-bff\dist\app.module.js:16:23)
at Object.<anonymous> (C:\repo\qvant\contacts-bff\dist\main.js:4:22)
from azure-ad-verify-token.
I struggled with this all day today, adding "moduleResolution": "Node16",
+ using await import()
works.
from azure-ad-verify-token.
Related Issues (18)
- Add expiry to the public key cache HOT 2
- Optimise cache
- Cannot read property 'header' of null HOT 1
- Handle v2.0 nonce HOT 3
- Dependency Dashboard
- Validation of a foreign token makes the lib get stuck on a never resolved promise HOT 2
- Error JsonWebTokenError: invalid signature HOT 1
- Allow array of strings for issuer option
- cannot seem to get the import to work correctly HOT 5
- dynamic import() does not work HOT 1
- security vulnerabilities (npm audit) HOT 1
- "Fixed bug for foreign token submission" still not able to handle jwt kid not in public keys
- Import failure HOT 1
- Broken imports on NextJS app HOT 2
- ESM module build failing because 'jsonwebtoken' module changed to CommonJs
- getPublicKey never resolves
- Proxy or custom requestClient configuration (aplications running behinden enterprise proxy)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-ad-verify-token.