# Compiler Options and Configurations in Insomnia's package.json: A Technical Deep Dive

> Explore Insomnia's package.json for compiler options and configurations. Learn how tsconfigjson orchestrates type checking with tsc and bundling with esbuild for efficient builds.

- Repository: [Kong/insomnia](https://github.com/Kong/insomnia)
- Tags: deep-dive
- Published: 2026-06-27

---

**Insomnia's build pipeline relies on strict TypeScript compiler settings defined in [`packages/insomnia/tsconfig.json`](https://github.com/Kong/insomnia/blob/main/packages/insomnia/tsconfig.json) while the root and workspace [`package.json`](https://github.com/Kong/insomnia/blob/main/package.json) files orchestrate the compilation through npm scripts that invoke `tsc` for type-checking and `esbuild` for bundling.**

The Kong/insomnia repository is a TypeScript-based Electron application that separates its compiler configuration from its build orchestration. While the [`package.json`](https://github.com/Kong/insomnia/blob/main/package.json) files define the workspace structure and script entry points, the actual **compiler options and configurations in Insomnia's package.json** ecosystem are implemented through a dedicated [`tsconfig.json`](https://github.com/Kong/insomnia/blob/main/tsconfig.json) and specialized build tools like `esr` (esbuild-runner).

## Root package.json and Workspace Constraints

The root [`package.json`](https://github.com/Kong/insomnia/blob/main/package.json) does not contain direct compiler flags but establishes the foundation for the build environment. It declares strict engine requirements—**Node.js ≥24** and **npm ≥11**—and defines the workspace structure that includes the main application package.

This file coordinates high-level scripts such as `dev`, `lint`, `type-check`, and `build`, which delegate to specific implementations in [`packages/insomnia/package.json`](https://github.com/Kong/insomnia/blob/main/packages/insomnia/package.json). The workspace configuration ensures consistent dependency resolution across the monorepo while leaving the granular TypeScript settings to the dedicated configuration file.

## TypeScript Compiler Configuration in tsconfig.json

The actual compiler options reside in [`packages/insomnia/tsconfig.json`](https://github.com/Kong/insomnia/blob/main/packages/insomnia/tsconfig.json). This configuration targets **ES2020** with **ESNext modules** and enforces maximum strictness for type safety in the Electron environment.

Key compiler options include:

- **`"target": "es2020"`** – Compiles to ECMAScript 2020 to ensure compatibility with modern Electron versions.
- **`"module": "ESNext"`** and **`"moduleResolution": "bundler"`** – Aligns with esbuild's module resolution strategy.
- **`"noEmit": true`** – Disables TypeScript output; the build pipeline uses esbuild for actual bundling rather than `tsc`.
- **`"strict": true`** – Enables all strict type-checking options including `noImplicitAny` and `strictNullChecks`.
- **`"isolatedModules": true`** – Ensures each file can be transpiled independently, required for Babel and esbuild compatibility.
- **`"verbatimModuleSyntax": true`** – Enforces consistent import/export syntax without transformation.
- **`"skipLibCheck": true`** and **`"esModuleInterop": true`** – Facilitates interoperability with CommonJS dependencies.

The configuration also maps path aliases through **`"paths": {"~/*": ["./src/*"]}`** and includes auto-generated React Router types via **`"rootDirs": [".", "./.react-router/types"]`**.

## Build Scripts and Compilation Pipeline

The `scripts` section in [`packages/insomnia/package.json`](https://github.com/Kong/insomnia/blob/main/packages/insomnia/package.json) bridges the TypeScript configuration with the execution environment. These scripts do not invoke `tsc` directly for emission but use it for type-checking while delegating bundling to esbuild.

**`npm run type-check`** executes:

```bash
react-router typegen && tsc --project tsconfig.json

```

This command generates React Router types first, then runs a pure type-checking pass using the strict options defined in [`tsconfig.json`](https://github.com/Kong/insomnia/blob/main/tsconfig.json) without emitting JavaScript files.

**`npm run build`** executes:

```bash
react-router build && esr --cache ./scripts/build.ts

```

This script triggers the React Router build process and invokes `esr` (esbuild-runner) with [`packages/insomnia/scripts/build.ts`](https://github.com/Kong/insomnia/blob/main/packages/insomnia/scripts/build.ts) as the entry point. The esbuild configuration consumes the same [`tsconfig.json`](https://github.com/Kong/insomnia/blob/main/tsconfig.json) for path resolution and type awareness but handles the actual bundling and minification, writing output to the [`esbuild.entrypoints.ts`](https://github.com/Kong/insomnia/blob/main/esbuild.entrypoints.ts) defined bundles.

## Practical Code Examples

To verify the compiler configuration locally, run the type-checker against the strict settings:

```bash

# Run TypeScript type-checking with the project's strict configuration

npm run type-check

```

To inspect how the TypeScript configuration interacts with the bundler, examine the build script:

```bash

# View the build script that coordinates esbuild with tsconfig settings

cat packages/insomnia/scripts/build.ts

```

For debugging specific files with the same compiler options but allowing emission:

```bash

# Compile a single file using the project's tsconfig but enable output

tsc src/main/main.ts \
  --project packages/insomnia/tsconfig.json \
  --noEmit false \
  --outDir ./tmp

```

## Summary

- The root [`package.json`](https://github.com/Kong/insomnia/blob/main/package.json) defines engine constraints (Node ≥24, npm ≥11) and workspace structure but delegates compiler specifics to [`tsconfig.json`](https://github.com/Kong/insomnia/blob/main/tsconfig.json).
- [`packages/insomnia/tsconfig.json`](https://github.com/Kong/insomnia/blob/main/packages/insomnia/tsconfig.json) contains the authoritative compiler options, targeting ES2020 with ESNext modules and full strictness enabled.
- **`"noEmit": true`** is configured because the build pipeline uses esbuild rather than `tsc` for generating JavaScript bundles.
- Build scripts in [`packages/insomnia/package.json`](https://github.com/Kong/insomnia/blob/main/packages/insomnia/package.json) use `react-router typegen` for code generation and `esr` for esbuild-based bundling.
- The configuration supports path aliasing (`~/*`) and includes auto-generated React Router type definitions in the compilation scope.

## Frequently Asked Questions

### Does Insomnia's package.json contain TypeScript compiler flags?

No, the compiler flags are not defined in [`package.json`](https://github.com/Kong/insomnia/blob/main/package.json). Instead, they reside in [`packages/insomnia/tsconfig.json`](https://github.com/Kong/insomnia/blob/main/packages/insomnia/tsconfig.json), while the [`package.json`](https://github.com/Kong/insomnia/blob/main/package.json) files contain npm scripts that reference this configuration file when invoking the TypeScript compiler.

### Why does Insomnia set "noEmit": true in tsconfig.json?

Insomnia sets `"noEmit": true` because the project uses **esbuild** for bundling rather than TypeScript's own compiler output. This configuration allows `tsc` to perform strict type-checking and provide IDE support while the `esr` (esbuild-runner) tool handles the actual code generation and minification in the build pipeline.

### What module resolution strategy does Insomnia use?

Insomnia uses `"moduleResolution": "bundler"` in its [`tsconfig.json`](https://github.com/Kong/insomnia/blob/main/tsconfig.json). This modern resolution strategy aligns with esbuild's behavior and supports features like `exports` fields in package.json, allowing the Electron application to resolve dependencies consistently with the bundler's expectations.

### How do I run a type-check without building the entire application?

Execute `npm run type-check` from the `packages/insomnia` directory or the workspace root. This command runs `react-router typegen` followed by `tsc --project tsconfig.json`, which validates type correctness using the strict compiler options without triggering the full esbuild bundling process or generating output files.