vite-plugin-lucide-preprocess weekly downloads statistics
By WarningImHack3r · npm · Vite plugins
A Vite plugin to tree-shake your Lucide icons.
vite-plugin-lucide-preprocess has 3,874 recorded weekly downloads on npm, a decrease of 37.0% over the past 30 days, ranking #1201 of 2,322 tracked listings.
About vite-plugin-lucide-preprocess
vite-plugin-lucide-preprocess
A Vite plugin to tree-shake your Lucide icons.
What is this?
If you want to import Lucide icons in your project, you can (usually — depending on the package) use two methods:
import { IconName } from "@lucide/svelte";
// or
import IconName from "@lucide/svelte/icons/icon-name";
While the first method is more convenient (and may be the one used by auto-import features in your editor),
it is not tree-shakable.
In fact, a single import from "lucide-<framework>" or "@lucide/<framework>"
will import all icons;
not ideal for Vite dev server performance and build time.
This plugin will replace the first method with the second one, so you can keep the convenience of the first method while benefiting from tree-shaking optimizations. “Correct” imports will be kept as-is.
[!NOTE] The plugin is primarily intended for
@lucide/svelte, but it works with any Lucide package using Vite. If it doesn't support a Lucide implementation, please open an issue.
Credits and opinion
I got the idea from Phosphor Icons' optimizer. However, this plugin is written from scratch and is not based on the Phosphor one, even though the technique is essentially the same.
Contrary to the experimental version of Phosphor Icons' implementation, this plugin is
a Vite plugin and not a Svelte one, it is more generic and can be used with any framework.
Additionally, it doesn't suffer from the limitations of the Svelte plugin, preventing the old Phosphor
optimizer from working without disabling the native Vite optimizations of phosphor-svelte.
This should subjectively be a feature embedded in Lucide itself (@lucide/svelte/preprocessor),
but I don't know if it will ever be implemented.
I opened an issue on the lucide-icons repository to discuss
this.
Auto-updater
As of version 1.1.0, the plugin includes an auto-updater. It helps support the renamed and deprecated icons by automatically updating the plugin when necessary.
If you use a recently deprecated icon and can't make your build work, please wait for a few hours for the plugin to update itself. If the problem persists, please open an issue in this repository.
More information about the auto-updater can be found in WarningImHack3r/vite-plugin-lucide-preprocess#6.
Installation
Install the plugin with your package manager of choice:
pnpm i vite-plugin-lucide-preprocess
Then, add it to your vite.config.js/.ts:
import { defineConfig } from "vite";
import lucidePreprocess from "vite-plugin-lucide-preprocess";
export default defineConfig({
plugins: [lucidePreprocess() /* , ... */]
});
[!WARNING] Make sure to add the plugin before any other preprocessors in the
pluginsarray.
Options
The plugin optionally accepts an object with the following options:
-
importMode(default:"esm"): The import mode for CommonJS-compatible frameworks."esm": Import the icons as ES modules."cjs": Import the icons as CommonJS modules.
This option is useful if you use a CommonJS-compatible framework like React or Vue. It will automatically replace the imports with the correct syntax depending on whether your framework supports CJS or not.
License
MIT
Description from the npm listing.
- vite
- vite-plugin
- lucide
- tree-shaking
- treeshaking
- tree-shake
- treeshake
- imports
- preprocessor
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (122)Similar npm Vite plugins plugins
All 20 vite-plugin-lucide-preprocess alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/vite-plugin-lucide-preprocess. First seen Oct 16, 2026; last successful collection Oct 20, 2026. See the methodology.