size-limit
- Version 11.2.0
- Published
- 37.5 kB
- 7 dependencies
- MIT license
Install
npm i size-limityarn add size-limitpnpm add size-limitOverview
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/timeParameter 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
falseit will disable any compression.
property compareWith
compareWith?: string;Path to
stats.jsonfrom another build to compare (when--whyis 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
trueit 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 testimport { 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.jsonly) 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
falseit will disable calculating running time.
property time
time?: TimeOptions;Options for
@size-limit/timeplugin.
property uiReports
uiReports?: object;Custom UI reports list.
See Also
property webpack
webpack?: boolean;With
falseit will disable webpack.
interface TimeOptions
interface TimeOptions {}Represents the options for the size-limit check time property to customize
@size-limit/timeplugin.
property latency
latency: string;Delay for calculating loading time that simulates network latency It should be a string with a number and unit, separated by a space. Format:
500 ms,1 s. @default: "0"
property loadingMessage
loadingMessage?: string;A message for loading time details "on slow 3G"
property networkSpeed
networkSpeed?: string;A network speed to calculate loading time of files. It should be a string with a number and unit, separated by a space. Format:
100 B,10 kB. "50 kB"
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 oneto 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[](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>
- Updated .
Package analyzed in 3411 ms. - Missing or incorrect documentation? Open an issue for this package.
