ivan-94_obsidian-plugin-man.../scripts/check-bundle-budget.mjs
2026-07-17 22:42:41 +08:00

10 lines
354 B
JavaScript

import { stat } from "node:fs/promises";
const MAX_BUNDLE_BYTES = 15 * 1024 * 1024;
const { size } = await stat("main.js");
if (size > MAX_BUNDLE_BYTES) {
throw new Error(`main.js is ${size} bytes; the self-contained plugin budget is ${MAX_BUNDLE_BYTES} bytes.`);
}
console.log(`main.js bundle: ${(size / 1024 / 1024).toFixed(2)} MiB / 15.00 MiB`);