fastify-tsconfig is a shared TypeScript configuration preset designed for Fastify projects, streamlining the setup of `tsconfig.json` files. The current stable version is `3.0.0`. This package aims to provide a consistent and modern TypeScript experience across Fastify applications and libraries, with a focus on contemporary Node.js environments. It configures `module` and `moduleResolution` to `NodeNext`, aligning with Node.js's native ESM capabilities and supporting both CommonJS and ES Modules based on `package.json`'s `type` field. It targets `ES2023` by default, requiring Node.js 20 or newer, which is a key differentiator for modern Fastify development, enabling the use of recent language features without additional transpilation steps. The release cadence is generally aligned with updates to TypeScript itself or Fastify's core ecosystem needs, rather than a fixed schedule.
npm install fastify-tsconfigVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to install `fastify-tsconfig`, extend it in `tsconfig.json`, configure `package.json` for ESM, and set up a basic Fastify application that can be built with `tsc`.
If supporting Node.js versions older than 20, add `"compilerOptions": { "target": "ES2022" }` (for Node.js >= 16.11.0) or an earlier ES target to your `tsconfig.json`.Ensure your Node.js version is at least 16.11.0. For older runtimes, downgrade to `fastify-tsconfig@1.x` or override the `target` compiler option.
Always include `"compilerOptions": { "outDir": "./dist" }` (or your preferred output directory) in your project's `tsconfig.json`.Review the 'Configuration module and moduleResolution' section in the README. Ensure your `package.json` `"type"` field is correctly set, and use `.mts` for ESM source files in CJS projects, or `.cts` for CJS source files in ESM projects, as needed.
Set `"type": "module"` in your `package.json` to enable ESM, or ensure all files using `import` syntax are correctly designated as ES Modules (e.g., using `.mjs` or `.mts` extensions in a CJS project if configured for it).
Ensure your `package.json` `"type"` field is correctly set. If `"type": "commonjs"`, ensure your source files use CommonJS syntax or are explicitly `.mts` if they need to be ESM. If `"type": "module"`, ensure all files are compatible ESM or use `.cts` for CommonJS files.
Verify that your `package.json` `exports` field (for modules within your project/monorepo) is correctly configured to point to your compiled JavaScript and declaration files. Ensure paths are relative and correctly specify `import` and `require` conditions if applicable.
No dependency data recorded yet.