[]previous and next page

DuskBuildBudgets

Size budgets of the production build, in gzip bytes.

Size budgets of the production build, in gzip bytes. dusk build prints a warning for each page over its budget, and fails the build instead when enforce is set. The size of a page is the JavaScript it loads first: its entry and the chunks of its route.

Import#

ts
import type { DuskBuildBudgets } from "@shadow-js/dusk/vite";

Signature#

ts
interface DuskBuildBudgets {
  /**
   * Fail the build (exit code 1, `DUSK_BUDGET_EXCEEDED` in `--json`) when a page is over its budget, after the summary is
   * printed. For CI: a regression of the bundle size stops the pipeline. A budget for a path no page has stays a warning.
   * @default false
   */
  readonly enforce?: boolean;
  /** The budget of every page's first-load JavaScript. */
  readonly firstLoadJs?: number;
  /** Budgets of single pages, by route path (`/dashboard`); each one replaces `firstLoadJs` for that page. */
  readonly routes?: Readonly<Record<string, number>>;
}

Members#

Name Type Description
enforce? readonly enforce?: boolean Fail the build (exit code 1, DUSK_BUDGET_EXCEEDED in --json) when a page is over its budget, after the summary is printed. For CI: a regression of the bundle size stops the pipeline. A budget for a path no page has stays a warning.
firstLoadJs? readonly firstLoadJs?: number The budget of every page's first-load JavaScript.
routes? readonly routes?: Readonly<Record<string, number>> Budgets of single pages, by route path (/dashboard); each one replaces firstLoadJs for that page.