Function: cached()
function cached(input: Plugin | {
name: string;
}): Plugin;Defined in: cached.ts:123
The plugin, with its transform results kept in .tomekit/cache/plugins, so the next build or dev server reuses each file's result instead of compiling it again.
A result is reused while the file's text and path, the Vite config and the local files it imports, the options passed to Vite, the lockfile and tomekit's version stay the same. Builds and dev, each mode and each Vite environment keep their own results. Every other hook of the plugin runs as before.
Parameters
input
Plugin | { name: string; }
Returns
Plugin
Example
// vite.config.ts
import mdx from "@mdx-js/rollup";
import { cached, tomekit } from "tomekit/vite";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [cached({ enforce: "pre", ...mdx() }), tomekit()],
});