commercetools / nodejs

Everything related to the Node.js ecosystem for the commercetools platform.
https://commercetools.github.io/nodejs/
MIT License
75 stars 70 forks source link

problem with sdk-auth in esmodule #1811

Closed Amenocy closed 2 years ago

Amenocy commented 2 years ago

we converted our cjs lambdas to esm to use top-level awaits. also we are using esbuild.

got error when trying to create new instance of SdkAuth, :

import SdkAuth from '@commercetools/sdk-auth';

error is:

 client: new import_sdk_auth.default({
          ^

TypeError: import_sdk_auth.default is not a constructor

tested with node 14,16 and 18.

Amenocy commented 2 years ago

i solved problem

import * as SdkAuth from '@commercetools/sdk-auth';

new SdkAuth.default.default({

but obviously it is just a trick.