I know there is plenty of topic around this question but I read a lot and I didn't found any answer.
I try to use a 3rd party through NPM in my nodeJS project (nest).
But when it compiles, I have the *.default is not a constructor error.
When I go into the source in the node_modules, I see the error.
const web3_1 = require("web3");
[...]
const getClient = async (options) => {
const { url } = options;
return new web3_1.default(url);
};
If I remove the default in here, it's working like a charm, but this is not something I control ...
I put the esModuleInterop to true in my tsconfig.json but that's not working.
Here is my tsconfig file
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"baseUrl": "./",
"incremental": true,
"strictNullChecks": true,
"strictBindCallApply": false,
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false,
"esModuleInterop": true,
"module": "CommonJS",
"target": "ES2018",
"declaration": true,
"noImplicitAny": false,
"removeComments": true,
"noLib": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"outDir": "./dist",
"rootDir": "./src",
"skipLibCheck": true
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules",
"**/*.spec.ts"
]
}
What am I missing?