Code Monkey home page Code Monkey logo

Comments (3)

justinlettau avatar justinlettau commented on June 18, 2024 1

@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.

vitjaz avatar vitjaz commented on June 18, 2024

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.

benjaminknox avatar benjaminknox commented on June 18, 2024

I struggled with this all day today, adding "moduleResolution": "Node16", + using await import() works.

from azure-ad-verify-token.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.