nodejs icon indicating copy to clipboard operation
nodejs copied to clipboard

problem with sdk-auth in esmodule

Open Amenocy opened this issue 3 years ago • 1 comments

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 avatar Oct 12 '22 14:10 Amenocy

i solved problem

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

new SdkAuth.default.default({

but obviously it is just a trick.

Amenocy avatar Oct 12 '22 15:10 Amenocy