No description
Find a file
2026-01-10 12:23:11 -05:00
.github/ISSUE_TEMPLATE workflow: remove terminal from issue template 2023-01-04 11:18:08 -06:00
doc update 2026-01-10 12:14:29 -05:00
lua Added Svelte file type 2023-09-14 10:08:53 +01:00
.gitignore initial commit 2022-12-31 14:08:30 -06:00
.stylua.toml initial commit 2022-12-31 14:08:30 -06:00
index.js fix detecting lang 2023-01-12 09:56:53 +09:00
install.ps1 install: create install script for windows 2023-05-03 16:01:35 +01:00
install.sh install(#6): use HTTPS in clone 2023-01-07 16:52:22 -06:00
readme.md one more iupdate 2026-01-10 12:23:11 -05:00

import-cost.nvim

Display the costs of javascript imports inside neovim with the power of import-cost.

preview

Installation

  1. Install regularly with your neovim package manager
    • NOTE: pnpm is not supported because import-cost does not.
  2. Run install.sh with your node.js package manager to setup import-cost:
sh install.sh '<your-package-manager>'

For example, a config with yarn and lazy.nvim may look like the following:

require('lazy').setup {
    {
        'barrettruth/import-cost.nvim',
        build = 'sh install.sh yarn',
        -- if on windows
        -- build = 'pwsh install.ps1 yarn',
        config = true
    }
}

Configuration

Configure via the setup function (or use the defaults with no arguments):

require('import-cost').setup(opts)

See :h import-cost for more information

Known Issues

  1. CommonJS support is particularly flaky - some packages work, some dont (this is by virtue of the npm module, and, thus, unavoidable)
  2. Long wait times - once again, the npm module may take quite a while before fully parsing packages
  3. pnpm problems

Acknowledgements

  1. wix/import-cost: provides the node backend that calculates the import costs
  2. import-cost: the original VSCode plugin that started it all
  3. vim-import-cost: inspired me to do it in neovim!