Git Product home page Git Product logo

Comments (6)

jonkoops avatar jonkoops commented on July 17, 2024 3

CommonJS and ESM interoperability is notoriously hard, so we'd rather stick to a standardized solution that everyone will be using in the future.

from keycloak-nodejs-admin-client.

kevinswarner avatar kevinswarner commented on July 17, 2024 1

Thanks. The transformIgnorePatterns seemed to work, but then I had to add several more node modules to the list. But, it is working ok now. Is there a reason you are not providing a CommonJS fallback? Just curious.

from keycloak-nodejs-admin-client.

gadielkalleb avatar gadielkalleb commented on July 17, 2024 1

"CommonJS and ESM interoperability is notoriously hard, so we'd rather stick to a standardized solution that everyone will be using in the future."

@jonkoops it's not like that, the vast majority of people/companies that are using this package still follow type commonsJS.
this answer is a bit lazy (I say this with all due respect) but making a package like this available, changing it from one moment to another, and letting everyone manage to configure their projects is a bit of bad faith.

I say this because I'm having the same problem as @kevinswarner , and our product is in production and I can't downgrade it because version 18 has a vulnerability pointed out by our sonarqube and we can't update to version ^20.0.1 because it has this "problem" with ESM, complicated.

at least we managed to fork the project

from keycloak-nodejs-admin-client.

jonkoops avatar jonkoops commented on July 17, 2024

You are using new JavaScript module syntax that is only supported when you enable it explicitly. For more information see the Node.js documentation.

from keycloak-nodejs-admin-client.

kevinswarner avatar kevinswarner commented on July 17, 2024

I understand that, but what I am confused about is Jest is transforming my code, and I am using "import" throughout to import other third party packages, without any issues. It is ONLY this package that is causing the error. So there is something different about THIS package that I am trying to understand so that I can figure out how to use it.

from keycloak-nodejs-admin-client.

jonkoops avatar jonkoops commented on July 17, 2024

The issue is likely due to the fact this package ships as a pure ESM library, without a CommonJS fallback. This is an issue in Jest that still needs to be resolved.

You'll either have to enable ESM mode (see documentation), or tweak transformIgnorePatterns so that this package is transformed by Jest (see jestjs/jest#11753 (comment)).

from keycloak-nodejs-admin-client.

Related Issues (20)

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.