-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Credo a pure ESM package #2157
Comments
Side note: for dcql-ts, and oid4vc-ts we have a build system that outputs to both cjs and esm. However due to the complexity of Credo's setup I don't want to support that for Credo. also because we depend on packages that have become ESM only, the model doesn't work, unless we bundle all dependencies within Credo |
@TimoGlastra This is acceptable, as moving from CJS to ESM also enhances security by utilizing modern module handling and enforcing stricter syntax. |
We will also have to wait for #2127 before doing such a task, as it would require a lot of changes to imports. |
Currently Credo outputs only CommonJS (CJS) code. This is the old way of doing things, and a new method "ESM" has been available for a long time.
Using ESM can be somewhat tricky to setup, however with modern tooling it's actually quite doable. Trouble comes when you try to import ESM from CommonJS, especially if you need to support multiple module syntaxes.
The Cheqd SDK has moved to ESM, and for that reason we're now on a very old version that still supports CJS.
I want to suggest we move Credo to a full ESM module. Node.JS fully supports ESM, and it's easy import ESM modules in Node.JS if you're also using ESM. React Native allows to easily transpile and use ESM modules as well.
For users of Node.JS that do not want to use ESM yet, there are several ways to import Credo:
await import()
The reason for moving to ESM is that it's becoming hard to not support ESM, but it's a pain to support both ESM and CJS due to how different they are in the resolution and compilation part.
I'd like to gather some input on whether moving to ESM is acceptable?
Also see https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
The text was updated successfully, but these errors were encountered: