i am trying to import a commonjs module into my existing typescript project with type: module. I have these files:
// server.cts module.exports = "hello"
//index.ts import * as server from './server.cjs';
//tsconfig.json
`{
"compilerOptions": {
"target": "ES5",
"module": "ES2015",
"outDir": "dist",
"sourceMap": true,
"esModuleInterop": true,
}, "include": ["src/**/*"], }`
When i compile and run it compiles the server.cts to;
module.exports = "suck"; export {}; //# sourceMappingURL=cllientServer.cjs.map
and gives the error: export {}; SyntaxError: Unexpected token 'export'.
This module stuff is really confusing at times
imported cjs with server exports