A Vite plugin (v0.3.1) that transforms named imports from lucide icon packages into default imports for improved dev server performance and tree-shaking. It is actively maintained with patches for Vite 8 compatibility and handles aliased icons, type imports, and multiple frameworks (React, Svelte, vanilla JS). Unlike alternatives that require manual refactoring, this plugin automates the conversion with zero config. Supports custom file extensions for other frameworks.
npm install vite-plugin-transform-lucide-importsVerified import paths — ran on the pinned version, not inferred.
Shows minimal Vite config with the plugin, and the transformation effect on import statements.
Ensure transformLucideImports() is listed after plugins that transpile files like .svelte or .vue.
Use this plugin only for lucide packages that lack built-in tree-shaking (e.g., lucide-react-native).
No action needed; the plugin automatically handles it.
Use with caution and review changelog before updating.
Enable 'verbatimModuleSyntax' in tsconfig.json to keep type imports explicit.
Change to: import transformLucideImports from 'vite-plugin-transform-lucide-imports';
Update to >=0.3.0 or remove the 'onwarn' option from plugin config.
Place transformLucideImports() after the Svelte/Vue plugin in the plugins array.
This warning is informational; no action needed. The import remains unchanged.