JavaScript File Size Too Large
Checks for JavaScript files that exceed recommended size limits
Checks for JavaScript files that exceed recommended size limits
| Rule ID | perf/js-file-size |
| Category | Performance |
| Scope | Site-wide |
| Severity | error |
| Weight | 7/10 |
Solution
Large JavaScript files block the main thread and delay interactivity. Code-split bundles into smaller chunks, tree-shake unused exports, lazy-load non-critical scripts, and defer or async load third-party scripts. Use dynamic imports for route-based splitting.
Options
This rule supports the following configuration options:
| Option | Type | Default | Description |
|---|---|---|---|
warn_bytes | number | 256000 (250KB) | Byte size to trigger warning |
error_bytes | number | 1048576 (1MB) | Byte size to trigger error |
Configuration Example
squirrel.toml
toml[rules."perf/js-file-size"]
warn_bytes = 256000
error_bytes = 1048576Enable / Disable
Disable this rule
squirrel.toml
toml[rules]
disable = ["perf/js-file-size"]Disable all Performance rules
squirrel.toml
toml[rules]
disable = ["perf/*"]Enable only this rule
squirrel.toml
toml[rules]
enable = ["perf/js-file-size"]
disable = ["*"]