Insanely Fast TypeScript Bundler

1.1.2 · active · verified Wed Apr 22

The `if-tsb` package, currently at version 1.1.2, is a TypeScript-focused bundler emphasizing speed and extensive configuration via `tsconfig.json`. It aims to provide a fast solution for compiling and bundling TypeScript projects, producing deployable JavaScript output. While a specific release cadence isn't published, its 1.x.x versioning suggests active development. Key differentiators include its deep integration with `tsconfig.json` for defining single or multiple entry points, custom output paths using template variables (e.g., `[name].bundled.js`), and a broad set of `bundlerOptions`. These options offer fine-grained control over aspects like module format (including non-standard ones like 'none', 'private'), external bundling, source map generation, and pre-import optimizations. It provides both a command-line interface for common bundling tasks and a programmatic API for integration into custom build workflows, distinguishing itself from general-purpose bundlers that typically rely on separate configuration files or a more standard set of module transformation options.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to install `if-tsb` and use its command-line interface to bundle a TypeScript project using configuration defined directly within `tsconfig.json`.

/*
// 1. Install if-tsb globally
npm install -g if-tsb

// 2. Create your TypeScript source file (e.g., src/index.ts):
*/

// src/index.ts
console.log("Hello from if-tsb!");
export function calculateSum(a: number, b: number): number {
  return a + b;
}

/*
// 3. Create or update your tsconfig.json in the project root:
//    This configures both TypeScript compilation and if-tsb bundling.
*/

// tsconfig.json
{
  "compilerOptions": {
    "target": "es2020",
    "module": "commonjs",
    "outDir": "./dist",
    "strict": true,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true
  },
  // if-tsb specific configuration for entry and output
  "entry": "./src/index.ts",
  "output": "./dist/bundle.js",
  "bundlerOptions": {
    "cleanConsole": true, // Clear console before each rebuild in watch mode
    "verbose": true       // Enable verbose output during bundling
  }
}

/*
// 4. Run if-tsb from your project root (where tsconfig.json is):
//    if-tsb will read the 'entry' and 'output' from tsconfig.json
*/

// Execute in your terminal:
// if-tsb ./tsconfig.json

/*
// Expected output structure after running:
// ./dist/bundle.js (the bundled JavaScript)
// ./dist/bundle.d.ts (the bundled declaration file if declarations are enabled)

// You can then use the bundled file:
// const { calculateSum } = require('./dist/bundle');
// console.log('Sum:', calculateSum(5, 7)); // Output: Sum: 12
*/

view raw JSON →