Import Cost Fast
Ruban SDisplay import/require package size in the editor
Published Package Summary
Import Cost Fast — coc.nvim Extension
This extension will display inline in the editor the size of the imported package.
The extension utilizes esbuild and SWC in order to detect the imported size.

Requirements
This is an extension for coc.nvim and requires that it be installed first.
Installation
Once you have coc.nvim installed, open Vim/Neovim, and execute:
:CocInstall coc-import-cost
You'll also need to enable the code lens feature in coc (:CocConfig):
"codeLens.enable": true
Features
Calculates the size of imports and requires. Currently supports:
- Default importing:
import Func from 'utils'; - Entire content importing:
import * as Utils from 'utils'; - Selective importing:
import {Func} from 'utils'; - Selective importing with alias:
import {orig as alias} from 'utils'; - Submodule importing:
import Func from 'utils/Func'; - Require:
const Func = require('utils').Func; - Supports both
JavascriptandTypescript
Why & How
We detail the why and how in this blog post: https://medium.com/@yairhaimo/keep-your-bundle-size-under-control-with-import-cost-vscode-extension-5d476b3c5a76
Credits
Forked from wix/import-cost, thanks to the wix team!
- 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
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.6.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"
],
"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"
}