Problem Statement
Propose a production tsconfig for a Node service; justify target, module, resolve, paths, outDir, sourceMap, and strict flags.
Explanation
Pick a modern target your runtime supports, use Node’s ESM settings, emit to dist, and keep strict on to catch bugs early. Source maps make logs debuggable. Paths help avoid deep relatives—align them with your bundler or resolver if you use one.
Code Solution
SolutionRead Only
// tsconfig.json (Node 18+ ESM)
{
"compilerOptions": {
"strict": true,
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "dist",
"rootDir": "src",
"sourceMap": true,
"esModuleInterop": true,
"baseUrl": ".",
"paths": { "@/*": ["src/*"] }
},
"include": ["src"]
}
// Rationale: modern JS output, correct resolution for Node ESM,
// clean dist folder, debuggable builds, strict typing, friendly import aliases.