K1|ller
K1|ller4mo ago

how to import superjson in express?

"The current file is a CommonJS module..." I set module to Node16 and moduleResolution to NodeNext but still not working, any clue?
No description
2 Replies
K1|ller
K1|llerOP4mo ago
guys i've been trying to fix this for an entire year 😂 at this point is it a bug?
david
david4mo ago
@K1|ller happy to try and help, it's definitely not a bug, most likely a configuration issue - could you share your tsconfig? Here's my current tsconfig on the backend, i'm also using superjson & express.
{
"compilerOptions": {
"target": "ES2020",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"useUnknownInCatchVariables": false,
"outDir": "./dist",
"rootDir": "./src",
"moduleResolution": "bundler"
},
"include": ["src/**/*.ts", "environment.d.ts"],
"exclude": ["node_modules"],
"ts-node": {
"swc": true
}
}
{
"compilerOptions": {
"target": "ES2020",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"useUnknownInCatchVariables": false,
"outDir": "./dist",
"rootDir": "./src",
"moduleResolution": "bundler"
},
"include": ["src/**/*.ts", "environment.d.ts"],
"exclude": ["node_modules"],
"ts-node": {
"swc": true
}
}