I'm using typescript.
When importing, I don't get any errors, but when starting the project, I get the following error:
TypeError: ChatwootClient is not a constructor at <anonymous> (/home/ozzyoss77/Workspace/evobot-chatwoot/src/Utils/regex.ts:14:16) at ModuleJob.run (node:internal/modules/esm/module_job:268:25) at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:543:26) at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5)
import ChatwootClient from "@figuro/chatwoot-sdk";
// console.log(ChatwootClient);
const client = new ChatwootClient({
config: {
basePath: "https://app.chatwoot.com",
with_credentials: true,
credentials: "include",
token: "itoken"
}
});
ChatwootClient log:
{
ApiError: [Getter],
CancelablePromise: [Getter],
CancelError: [Getter],
ChatwootAPI: [Getter],
default: [class ChatwootClient]
}
This is my tsconfig.json configuration:
{
"compilerOptions": {
"target": "ES2022",
"module": "ES2022",
"declaration": false,
"declarationMap": false,
"moduleResolution": "node",
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": false,
"outDir": "./dist",
"baseUrl": "./",
"rootDir": "./",
"incremental": true,
"skipLibCheck": true,
"paths": {
"~/*": ["./src/*"]
}
},
"include": [
"**/*.js",
"**/*.ts"
],
"exclude": [
"node_modules",
"dist",
"**/*.test.ts",
"**/*.spec.ts",
"**e2e**",
"**mock**"
]
}
Am I doing something wrong?
I'm using typescript.
When importing, I don't get any errors, but when starting the project, I get the following error:
TypeError: ChatwootClient is not a constructor at <anonymous> (/home/ozzyoss77/Workspace/evobot-chatwoot/src/Utils/regex.ts:14:16) at ModuleJob.run (node:internal/modules/esm/module_job:268:25) at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:543:26) at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5)ChatwootClient log:
This is my
tsconfig.jsonconfiguration:Am I doing something wrong?