Size Limit preset for big open source libraries
—
Size Limit preset for big open source libraries (> 10 kB) that combines webpack, file, and time plugins to provide comprehensive performance monitoring including tracking the time of JavaScript download and execution for the library and all its dependencies.
npm install @size-limit/preset-big-libsize-limit@11.2.0import preset from "@size-limit/preset-big-lib";For CommonJS (if supported by bundler):
const preset = require("@size-limit/preset-big-lib");Package.json access:
import packageJson from "@size-limit/preset-big-lib/package.json";This preset is designed to be used with Size Limit configuration. It provides a pre-configured combination of plugins for comprehensive performance monitoring of large libraries.
// size-limit.config.js
import preset from "@size-limit/preset-big-lib";
export default [
{
name: "My Big Library",
path: "dist/index.js",
plugins: preset,
limit: "50 kB"
}
];Or in package.json:
{
"size-limit": [
{
"name": "My Big Library",
"path": "dist/index.js",
"plugins": ["@size-limit/preset-big-lib"],
"limit": "50 kB"
}
]
}This preset combines three Size Limit plugins:
The preset exports these plugins as a combined array, making it easy to apply comprehensive performance monitoring to large libraries without manual plugin configuration.
The main and only export of this package - a combined array of Size Limit plugins optimized for big libraries.
/**
* Size Limit preset combining webpack, file, and time plugins
* Exports: [...webpack, ...file, ...time]
*/
export default Array<SizeLimitPlugin>;
interface SizeLimitPlugin {
// Internal Size Limit plugin interface
// Specific structure depends on Size Limit implementation
}Usage:
The preset is used by importing it and applying it to Size Limit configuration. When applied, it provides:
Configuration Example:
import preset from "@size-limit/preset-big-lib";
// Apply to Size Limit configuration
const config = [
{
name: "Main Bundle",
path: "dist/main.js",
plugins: preset, // Uses the combined plugin array
limit: "100 kB"
}
];This preset includes the following Size Limit plugins as dependencies:
@size-limit/webpack@11.2.0 - Webpack bundling analysis plugin@size-limit/file@11.2.0 - File size measurement plugin@size-limit/time@11.2.0 - JavaScript execution time measurement pluginsize-limit@11.2.0 - Core Size Limit library (also required as peer dependency)The preset simply re-exports these plugins in a combined array format, providing a convenient way to apply comprehensive performance monitoring to large libraries without manually configuring individual plugins.
Install with Tessl CLI
npx tessl i tessl/npm-size-limit--preset-big-lib