Comments (7)
We are currently compiling this package in the CommonJS format, the quirkiness we are seeing here is a side-effect of the TypeScript compiler. Now that Node.js 12 is no longer supported we intend to compile to ESM instead.
There are no intentions to have this package contain both ESM and CommonJS entry points and we'd rather opt for a pure ESM package instead. Node.js provides interoperability between these two so that it should 'just work' so I expect this will improve the developer experience.
from keycloak-nodejs-admin-client.
Closing this as we landed pure ES module support in #381.
from keycloak-nodejs-admin-client.
@jonkoops, i would reconsider the distribution of commonjs module(following this rules https://nodejs.org/api/esm.html#esm_commonjs_namespaces), if only ships ESM modules this project force to move all code database of project to use ESM (or transpile code), this, even now, its not clear in nodejs core maintainers because commonjs its not going to be deprecate in a future and a large number of packages are still only in commonjs. Here its the personal recommendation of a nodejs maintainer (Matteo collina) about this topic:
from keycloak-nodejs-admin-client.
@jonkoops, i would reconsider the distribution of commonjs module(following this rules https://nodejs.org/api/esm.html#esm_commonjs_namespaces), if only ships ESM modules this project force to move all code database of project to use ESM (or transpile code), this, even now, its not clear in nodejs core maintainers because commonjs its not going to be deprecate in a future and a large number of packages are still only in commonjs. Here its the personal recommendation of a nodejs maintainer (Matteo collina) about this topic:
I agree, our solution for now is to move away from keycloak due to the response to this ticket and some other technical limitations.
I was disappointed with the response, it seemed needlessly strict, especially since packaging for both esm and cjs is pretty simple and a common practice.
from keycloak-nodejs-admin-client.
especially since packaging for both esm and cjs is pretty simple and a common practice.
No, it's not.
if only ships ESM modules this project force to move all code database of project to use ESM
It doesn't force you to do this, you can still import ES modules from CommonJS. However there are caveats. You'll have to use the dynamic import()
, and since top-level await is not supported in CommonJS you'll have to wrap your code in an IIFE.
You can find more information about this in this excellent blog post by @adam-coster.
That said, I am a fervent supporter of moving things to ESM, so my recommendation will always be to try to use it wherever possible.
from keycloak-nodejs-admin-client.
No, it's not.
Are you sure? https://antfu.me/posts/publish-esm-and-cjs
I've bundled for both without any major issues.
from keycloak-nodejs-admin-client.
I agree with claytongulick. I investigated for a few hours how to get the latest wersions of the package working with the existing codebase and I've decided that it's not worth the effort. Keycloak seerver is a great software, but this library can be easily replaced with some homemade call. It's a shame because I always prefere to use official clients, but I cannot afford to lose days and days of work just to have some REST call done.
Surely ES modules are the future, but at the moment commonjs is too much ubiquitous to be ignored.
from keycloak-nodejs-admin-client.
Related Issues (20)
- Add EvaluationResultRepresentation
- Get Multiple Users by Id HOT 1
- Add exportResource return type
- Add support for generating example IdToken and UserInfo for client-scope evaluation
- Support custom request headers injection HOT 1
- misleading 405 error when trying to delete a resource by passing undefined/null resource ID HOT 2
- Client randomly adds extraneous slashes HOT 1
- findOne by username returns multiple users in array HOT 4
- 403 Forbidden on a newly created Realm HOT 3
- users.find() also return their federated identities HOT 1
- Support oauth2DeviceAuthorizationGrantEnabled flag when creating clients HOT 1
- Package "react-monaco-editor" not found. Have you installed it? HOT 1
- Webpack Compilation Error: "You may need an appropriate loader to handle this file type" error after upgrading to 19.0.0 HOT 2
- Error: "Cannot use import statement outside a module" HOT 6
- Error [ERR_REQUIRE_ESM] HOT 32
- Creating a Client Scope does not return the ID HOT 1
- Add support for finding groups by their path name HOT 1
- Backward compatibility to support CommonJS HOT 1
- Unable to specify roles with new user creation HOT 1
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 keycloak-nodejs-admin-client.