tsconfig.json and Custom tsconfig Path Integration
This page explains how Susee uses TypeScript compiler settings and how to provide a custom tsconfig path for different build workflows.
Why this matters
Your tsconfig.json controls important compile behavior, such as:
targetmodule- declaration output behavior
- source maps
In Susee, these options are applied to build output generation for each entry point. When needed, you can override the default tsconfig location per entry or per CLI command.
Resolution priority
Susee resolves TypeScript options using this order:
- A custom path (
entryPoints[].tsconfigFilePathin config mode, or--tsconfigin CLI build mode) - Root
tsconfig.json - Internal default compiler options
This gives you predictable behavior while still allowing advanced setups.
Default setup with root tsconfig.json
If you do not pass a custom path, Susee tries to use your root tsconfig.json.
Example:
{
"compilerOptions": {
"target": "esnext",
"module": "nodenext",
"declaration": true,
"declarationMap": true,
"sourceMap": true
}
}Config-mode integration (susee.config.ts)
Use tsconfigFilePath when one entry point needs compiler settings that differ from the rest of the package.
import type { SuSeeConfig } from "susee";
const config: SuSeeConfig = {
entryPoints: [
{
entry: "src/index.ts",
exportPath: ".",
format: ["esm", "commonjs"],
tsconfigFilePath: "tsconfig.build.json",
},
{
entry: "src/cli.ts",
exportPath: "./cli",
format: ["esm"],
tsconfigFilePath: "configs/tsconfig.cli.json",
},
],
outDir: "dist",
};
export default config;CLI-mode integration (susee build)
For direct CLI builds, pass a custom path with --tsconfig.
susee build src/index.ts --format esm --tsconfig ./configs/tsconfig.build.jsonThis is useful for one-off builds in CI or local experiments without changing susee.config.ts.
Recommended pattern: base + build tsconfig
For medium and large packages, keep a shared base file and extend it in build-specific files.
tsconfig.base.json:
{
"compilerOptions": {
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true
}
}tsconfig.build.json:
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"sourceMap": true
},
"include": ["src/**/*"]
}Then reference tsconfig.build.json from either:
entryPoints[].tsconfigFilePathinsusee.config.ts--tsconfiginsusee build
Path tips
- Use project-relative paths consistently.
- Keep custom tsconfig files inside the package (for example,
configs/). - In monorepos, prefer package-local tsconfig files to avoid accidental cross-package compiler settings.
Troubleshooting
If output does not match your expected compiler behavior:
- Verify the custom path is correct and file exists.
- Check whether build is running in config mode or direct CLI mode.
- Confirm the intended file is passed via
tsconfigFilePathor--tsconfig. - Recheck your
extendschain andinclude/excludeentries.