-
-
Save dillionverma/4450c1fc106002117c3aa35bddab9e94 to your computer and use it in GitHub Desktop.
| 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": ".", | |
| } | |
| } |
Just added instructions for how to fix lucide-react collisions.
Make sure tsconfig.json has baseUrl set so autoimport works correctly.
Installation
- Add
lucide-react.d.tsto project - Add
.vscode/settings.jsonto project - Update
tsconfig.jsonto havebaseUrl: "." - Restart TS server in cursor/vscode
Interestingly, the ExcludeRegexes did not work, but Patterns did
"typescript.preferences.autoImportFileExcludePatterns": ["@radix-ui/react-*"]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.
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
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
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
Using this approach implies that Icon imports will always be suffixed with
Icon. For exampleExternalLinkwill no longer work butExternalLinkIconwill. @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!
Add this to
.vscode/settings.jsonin your project or your global vscode settings