unplugin-ts-mock

JSON →
library 0.2.1 ·javascript
verified Jun 4, 2026

A build-time bundler plugin (v0.2.1) that scans TypeScript types and auto-generates faker-based mock data, replacing createMock<T>() calls with inline object literals. Supports Vite, Rollup, webpack, and esbuild. Handles interfaces, type aliases, enums, unions, intersections, tuples, utility types (Partial, Required, etc.), and field name inference (e.g., *Id → UUID). No runtime overhead; types reference project + node_modules. Caveats: optional fields omitted ~30% of the time, advanced utility types (Extract, Exclude) generate empty objects. Requires Node >=20.11.0 and one of the supported bundlers (vite >=4, rollup >=3, webpack >=5, esbuild >=0.18).