Import Cost Fast
Ruban SDisplay import/require package size in the editor
Published Package Summary
Import Cost Fast — coc.nvim
See the bundle size of every import in Vim/Neovim.
Display import sizes as virtual text using coc.nvim. Powered by esbuild and es-module-lexer.

Requirements
- coc.nvim installed and configured
- Code lens enabled in coc config
Installation
:CocInstall coc-import-cost-fast
Enable code lens (:CocConfig):
{
"codeLens.enable": true
}
Features
- Inline size display — minified, gzipped, and brotli sizes shown as virtual text
- All import patterns —
import,import *,import { },require(), dynamicimport() - Language support — JavaScript, TypeScript, Vue, and Svelte
- Cached results — sizes cached per package + version for instant display
- Tree-shake awareness — reports if a package supports tree-shaking
- Brotli compression — shows brotli alongside gzip
- Budget warnings —
⚠ over budget!when imports exceed configuredbudgetKB - Lighter alternatives — suggests smaller replacements (moment → dayjs, lodash → lodash-es)
- Estimated sizes —
~prefix when bundling falls back to entry file size
Credits
Forked from wix/import-cost, rewritten in TypeScript with esbuild and es-module-lexer.
License
MIT
- Display import/require package size in the editor
- onLanguage:javascript
- onLanguage:javascriptreact
- onLanguage:javascript.jsx
- onLanguage:typescript
- onLanguage:typescript.tsx
- onLanguage:typescript.jsx
- onLanguage:typescriptreact
- onLanguage:vue
- onLanguage:svelte
Want to build, test, or contribute to coc.nvim extensions? Explore our official SDK and testing toolkits.
Open Developer GuideVersion History
This published npm package does not include a history.md or changelog.md file. Browse its npm versions or repository releases for available release information.
Contributed Commands
All contributes.commands entries from the published package manifest for coc-import-cost-fast@3.7.0.
| Command (:CocCommand) | Description |
|---|---|
| importCost.toggle | Toggle import cost |
Configuration Schema
All contributes.configuration entries from the published package manifest, including each raw property schema for coc-settings.json.
Raw JSON Schema
{
"type": "boolean",
"default": false,
"description": "Enable debug logging"
}Raw JSON Schema
{
"type": "number",
"default": 10000,
"description": "Size calculation timeout in milliseconds (requires restart)"
}Raw JSON Schema
{
"enum": [
"both",
"minified",
"gzipped",
"gzip",
"brotli",
"compressed"
],
"type": "string",
"default": "both",
"description": "Which bundle size to display"
}Raw JSON Schema
{
"type": "array",
"default": [
"\\.jsx?$"
],
"description": "File extensions to be parsed by the Javascript parser"
}Raw JSON Schema
{
"type": "array",
"default": [
"\\.tsx?$"
],
"description": "File extensions to be parsed by the Typescript parser"
}Raw JSON Schema
{
"type": "boolean",
"default": true,
"description": "Display the 'calculating' decoration when starting to calculate the size"
}