Skip to content

Instantly share code, notes, and snippets.

@dillionverma
Last active June 9, 2025 23:09
Show Gist options
  • Save dillionverma/4450c1fc106002117c3aa35bddab9e94 to your computer and use it in GitHub Desktop.
Save dillionverma/4450c1fc106002117c3aa35bddab9e94 to your computer and use it in GitHub Desktop.
How to stop @radix-ui, next/router and lucide-react auto-imports
declare module 'lucide-react' {
export * from 'lucide-react/dist/lucide-react.suffixed'
}
{
"typescript.preferences.autoImportSpecifierExcludeRegexes": [
"@radix-ui",
"next/router",
"next/dist",
"^lucide-react/dist/lucide-react.suffixed$",
]
}
{
"compilerOptions": {
"baseUrl": ".",
}
}
@chris-orgorg
Copy link

For the lucide-react.d.ts file I get this error: Cannot find module 'lucide-react/dist/lucide-react.suffixed' or its corresponding type declarations.

The non-".suffixed" import works but not what I desire.

I might just be out of date on the package, but leaving this here as a question for others too, might answer my own question when I upgrade packages.

+1

@Ardian-Hoti
Copy link

how do i import icons from lucide-react with this?, its not working

Module '"lucide-react"' has no exported member 'ExternalLink'.
and for other icons

@dillionverma
Copy link
Author

Using this approach implies that Icon imports will always be suffixed with Icon. For example ExternalLink will no longer work but ExternalLinkIcon will. @Ardian-Hoti

@Ardian-Hoti
Copy link

Using this approach implies that Icon imports will always be suffixed with Icon. For example ExternalLink will no longer work but ExternalLinkIcon will. @Ardian-Hoti

Oh okay, so i have to change all my icons in my entire app to have icon in the end, okay a bit of work for now but for future time saver. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment