Size Limit preset for small open source libraries that combines esbuild and file plugins to track bundle sizes
npx @tessl/cli install tessl/npm-size-limit--preset-small-lib@11.2.0@size-limit/preset-small-lib is a Size Limit preset for small open source libraries. It provides a preconfigured setup that combines esbuild and file plugins to efficiently track the size of all files and dependencies in JavaScript libraries, enabling developers to automatically monitor and control bundle sizes in their CI pipelines.
npm install --save-dev size-limit @size-limit/preset-small-libSize Limit automatically loads this preset when installed. For advanced use cases where you need to import the preset directly:
import preset from "@size-limit/preset-small-lib";For CommonJS environments:
const preset = require("@size-limit/preset-small-lib").default;The preset is automatically loaded by Size Limit when installed. Configure it in your package.json:
{
"size-limit": [
{
"path": "index.js"
}
],
"scripts": {
"size": "size-limit"
}
}Run the size check:
npm run sizeWhen using this preset, Size Limit will automatically:
This preset is built on Size Limit's plugin architecture and combines two essential plugins:
The preset integrates with Size Limit's step-based processing system where plugins execute in numbered phases (step20, step40, step60, step61) to build, measure, and adjust size calculations.
The main export that provides the combined plugin configuration for Size Limit.
/**
* Default export containing the preset configuration
* Combines @size-limit/esbuild and @size-limit/file plugins
*/
declare const preset: SizeLimitPlugin[];
export default preset;This preset internally combines the following Size Limit plugins:
The preset combines plugins that handle different phases of Size Limit's processing:
Each plugin implements various processing steps (step20, step40, step60, step61) in Size Limit's execution pipeline.
/**
* The preset exports an array of Size Limit plugins
*/
type PresetExport = SizeLimitPlugin[];
interface SizeLimitPlugin {
name: string;
before?(config: object): Promise<void>;
finally?(config: object, check: object): Promise<void>;
step20?(config: object, check: object): Promise<void>;
step40?(config: object, check: object): Promise<void>;
step60?(config: object, check: object): Promise<void>;
step61?(config: object, check: object): Promise<void>;
wait40?: string;
}This preset has the following dependencies:
Peer Dependencies:
Direct Dependencies:
This preset is ideal for: