size-limit-node-esbuild
raw JSON →Node esbuild plugin for Size Limit, a lightweight tool to measure JavaScript bundle sizes. Current stable version is 0.4.0, released with major bump to size-limit v11. This plugin enables size-limit to process Node.js bundles using esbuild, an extremely fast bundler and minifier. It integrates with size-limit's configuration system and supports ESM and CJS outputs. Key differentiators: leverages esbuild's speed for CI size checks, supports modern Node.js (^12.20.0 || ^14.18.0 || >=16.0.0), ships TypeScript types, and is part of the un-ts/size-limit ecosystem. Release cadence is irregular, with major breaking changes tracking size-limit major updates. Compared to alternatives like webpack or rollup plugins, it offers faster builds for Node-focused targets.
Common errors
error ERR_REQUIRE_ESM: require() of ES Module ↓
error Cannot find module 'size-limit-node-esbuild' ↓
pnpm add -D size-limit-node-esbuild (or npm/yarn equivalent). error Invalid plugin: must be a function or an object with a 'name' property ↓
Warnings
breaking v0.3.0 migrated to ESM only, breaking CommonJS require() ↓
breaking v0.4.0 bumped size-limit peer dependency to v11, breaking compatibility with older size-limit versions ↓
breaking v0.2.0 upgraded to size-limit v8, breaking configurations for v7 ↓
deprecated No deprecation warnings known for this package.
gotcha Plugin must be placed in the 'plugin' array of size-limit config, not 'plugins' ↓
gotcha The plugin inherits default esbuild config but may need explicit 'target' for Node version ↓
Install
npm install size-limit-node-esbuild yarn add size-limit-node-esbuild pnpm add size-limit-node-esbuild Imports
- default wrong
const sizeLimitNodeEsbuild = require('size-limit-node-esbuild')correctimport sizeLimitNodeEsbuild from 'size-limit-node-esbuild' - sizeLimitNodeEsbuild wrong
import { sizeLimitNodeEsbuild } from 'size-limit-node-esbuild'correctimport sizeLimitNodeEsbuild from 'size-limit-node-esbuild' - type SizeLimitNodeEsbuildOptions
import type { SizeLimitNodeEsbuildOptions } from 'size-limit-node-esbuild'
Quickstart
// Install: pnpm add -D size-limit @size-limit/preset-app size-limit-node-esbuild
// size-limit.config.js
import sizeLimitNodeEsbuild from 'size-limit-node-esbuild';
export default [
{
path: "dist/index.js",
plugin: [sizeLimitNodeEsbuild],
limit: "10 KB",
},
];
// Run: npx size-limit