Hey guys! We are developing in a node environment and are having some incompatibility issues with the ESM packaging on the http client. We are seeing an ERR_REQUIRE_ESM when attempting to import the http-client module. Is the only way to use the http-client to transition our app from using CommonJs to ESM? We are using CommonJs because it is the recommended module type for using the Hardhat framework for a Typescript application.
I found a workaround for hardhat typescript to use ESM, but this would require a large undertaking of changing tons of import statements to update relative imports and etc to make it compatible with ESM. Support for ESM in TypeScript projects · Issue #3385 · NomicFoundation/hardhat · GitHub I can see this as a workaround if it is not possible to use commonJs with ceramic http-client, but hopefully this can be avoided
Hi, you can import ESM from CJS modules using await import('@ceramicnetwork/http-client')
is most versions of Node, also possibly using require('@ceramicnetwork/http-client')
if you use Node’s --experimental-require-module
flag, see Modules: CommonJS modules | Node.js v22.9.0 Documentation