size-limit

  • Version 11.1.4
  • Published
  • 35.6 kB
  • 7 dependencies
  • MIT license

Install

npm i size-limit
yarn add size-limit
pnpm add size-limit

Overview

CLI tool for Size Limit

Index

Functions

function sizeLimitAPI

sizeLimitAPI: (
plugins: AnyFunction[],
files: string[] | object
) => Promise<object>;
  • Run Size Limit and return the result.

    Parameter plugins

    The list of plugins like @size-limit/time

    Parameter files

    Path to files or internal config Project size

Interfaces

interface Check

interface Check {}
  • Represents the options for the size-limit check.

property brotli

brotli?: boolean;
  • With false it will disable any compression.

property compareWith

compareWith?: string;
  • Path to stats.json from another build to compare (when --why is using).

property config

config?: string;
  • A path to a custom webpack config.

property disableModuleConcatenation

disableModuleConcatenation?: boolean;

    property entry

    entry?: string | string[];
    • When using a custom webpack config, a webpack entry could be given. It could be a string or an array of strings. By default, the total size of all entry points will be checked.

    property gzip

    gzip?: boolean;
    • With true it will use Gzip compression and disable Brotli compression.

    property hidePassed

    hidePassed?: boolean;

      property highlightLess

      highlightLess?: boolean;

        property ignore

        ignore?: string[];
        • An array of files and dependencies to exclude from the project size calculation.

        property import

        import?: string | Record<string, string>;
        • Partial import to test tree-shaking. It could be "{ lib }" to test import { lib } from 'lib', * to test all exports, or { "a.js": "{ a }", "b.js": "{ b }" } to test multiple files.

        property limit

        limit?: string;
        • Size or time limit for files from the path option. It should be a string with a number and unit, separated by a space. Format: 100 B, 10 kB, 500 ms, 1 s.

        property modifyEsbuildConfig

        modifyEsbuildConfig?: (config?: any) => any;

          property modifyWebpackConfig

          modifyWebpackConfig?: (config?: any) => any;
          • (.size-limit.js only) Function that can be used to do last-minute changes to the webpack config, like adding a plugin.

          property module

          module?: boolean;

            property name

            name?: string;
            • The name of the current section. It will only be useful if you have multiple sections.

            property path

            path: string | string[];
            • Relative paths to files. The only mandatory option. It could be a path "index.js", a "dist/app-*.js" or an array ["index.js", "dist/app-*.js", "!dist/app-exclude.js"].

            property running

            running?: boolean;
            • With false it will disable calculating running time.

            property uiReports

            uiReports?: object;
            • Custom UI reports list.

              See Also

            property webpack

            webpack?: boolean;
            • With false it will disable webpack.

            Type Aliases

            type SizeLimitConfig

            type SizeLimitConfig = Check[];

              Package Files (1)

              Dependencies (7)

              Dev Dependencies (0)

              No dev dependencies.

              Peer Dependencies (0)

              No peer dependencies.

              Badge

              To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

              You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/size-limit.

              • Markdown
                [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/size-limit)
              • HTML
                <a href="https://www.jsdocs.io/package/size-limit"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>