Skip to content

Quick start

ts
import { defineConfig } from "vite";

import { buildInfo, bundleBudget, compression, envGuard, subresourceIntegrity } from "fast-vite-plugins";

export default defineConfig({
	plugins: [
		envGuard({
			schema: { VITE_API_URL: { pattern: /^https:\/\// } },
		}),
		buildInfo(),
		subresourceIntegrity({ manifest: true }),
		bundleBudget({
			budgets: [
				{ name: "entry JavaScript", filter: /\.js$/, limit: 250 * 1024 },
				{ name: "all CSS (gzip)", filter: /\.css$/, limit: 50 * 1024, mode: "gzip", scope: "total" },
			],
		}),
		compression({ algorithms: ["gzip", "brotli"], threshold: 10 * 1024 }),
	],
});

Every plugin is imported and configured independently. The package does not enable implicit behavior.

ts
import { buildInfo, htmlTemplate } from "fast-vite-plugins";

export default defineConfig({
	plugins: [htmlTemplate({ data: { APP_TITLE: "Fast Admin" }, strict: true }), buildInfo({ fileName: "meta/build-info.json" })],
});