@wroud/vite-plugin-tsc

0.11.5 • Public • Published

@wroud/vite-plugin-tsc

ESM-only package NPM version

@wroud/vite-plugin-tsc is a Vite plugin designed to transpile TypeScript and its project references using the TypeScript compiler (tsc). This plugin allows Vite to seamlessly bundle the transpiled code while also providing background type checking for your project, ensuring type safety and enhancing the development workflow.

Features

  • Transpilation: Automatically transpiles TypeScript code using tsc.
  • Background Type Checking: Performs type checking in the background without blocking Vite, allowing for a smoother development experience.
  • Watch Mode: Supports watch mode for continuous development.
  • Easy Integration: Simple to add to your Vite project.

Installation

Install via npm:

npm install @wroud/vite-plugin-tsc

Install via yarn:

yarn add @wroud/vite-plugin-tsc

Documentation

For detailed usage and API reference, visit the documentation site.

Example - Transpilation

import { defineConfig } from "vite";
import { tscPlugin } from "@wroud/vite-plugin-tsc";

export default defineConfig({
  plugins: [
    tscPlugin({
      tscArgs: ["-b"],
      // Enable prebuild to ensure dependencies are built before Vite starts bundling
      prebuild: true, // Recommended for projects with TypeScript project references
    }),
  ],
});

Example - Type Checking Only

import { defineConfig } from "vite";
import { tscPlugin } from "@wroud/vite-plugin-tsc";

export default defineConfig({
  plugins: [
    tscPlugin({
      tscArgs: ["--project", "tsconfig.json"],
      // Prebuild is not needed for type checking only
      prebuild: false, // Skip prebuilding for faster startup
      enableOverlay: true, // Show errors in Vite overlay
    }),
  ],
});

Changelog

All notable changes to this project will be documented in the CHANGELOG file.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Dependents (0)

Package Sidebar

Install

npm i @wroud/vite-plugin-tsc

Homepage

wroud.dev

Weekly Downloads

8

Version

0.11.5

License

MIT

Unpacked Size

22 kB

Total Files

10

Last publish

Collaborators

  • wroud