nodejs
nodejs copied to clipboard
problem with sdk-auth in esmodule
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.
i solved problem
import * as SdkAuth from '@commercetools/sdk-auth';
new SdkAuth.default.default({
but obviously it is just a trick.