mirror of
https://github.com/lucide-icons/lucide.git
synced 2025-12-16 14:57:42 +01:00
Add override alias import entry files lucide-react
This commit is contained in:
25
docs/guide/advanced/aliased-names.md
Normal file
25
docs/guide/advanced/aliased-names.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Aliased Names
|
||||
|
||||
Icons can have multiple names for the same icon. This is because we choose to rename some icons to make them more consistent with the rest of the icon set, or the name was not generic. For example, the `edit-2` icon is renamed to `pen` to make the name more generic, since it is just a pen icon.
|
||||
|
||||
Beside aliases names lucide also includes prefixed and suffixed names to use within your project. This is to prevent import name collisions with other libraries or your own code.
|
||||
|
||||
```tsx
|
||||
// These are all the same icon
|
||||
import {
|
||||
Home,
|
||||
HomeIcon,
|
||||
LucideHome,
|
||||
} from "lucide-react";
|
||||
```
|
||||
|
||||
|
||||
## Choosing import name style
|
||||
|
||||
|
||||
|
||||
```ts
|
||||
declare module "lucide-react" {
|
||||
export * from "lucide-react/dist/lucide-react.prefixed";
|
||||
}
|
||||
```
|
||||
@@ -98,5 +98,12 @@ export default [
|
||||
}],
|
||||
plugins: [dts()],
|
||||
},
|
||||
{
|
||||
input: 'src/lucide-react.prefixed.ts',
|
||||
output: [{
|
||||
file: `dist/lucide-react.prefixed.d.ts`, format: "es"
|
||||
}],
|
||||
plugins: [dts()],
|
||||
},
|
||||
...configs
|
||||
];
|
||||
|
||||
8
packages/lucide-react/src/lucide-react.prefixed.ts
Normal file
8
packages/lucide-react/src/lucide-react.prefixed.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export * as icons from './icons';
|
||||
export * from './aliases';
|
||||
export {
|
||||
default as createLucideIcon,
|
||||
type IconNode,
|
||||
type LucideProps,
|
||||
type LucideIcon,
|
||||
} from './createLucideIcon';
|
||||
8
packages/lucide-react/src/lucide-react.suffixed.ts
Normal file
8
packages/lucide-react/src/lucide-react.suffixed.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export * as icons from './icons';
|
||||
export * from './aliases';
|
||||
export {
|
||||
default as createLucideIcon,
|
||||
type IconNode,
|
||||
type LucideProps,
|
||||
type LucideIcon,
|
||||
} from './createLucideIcon';
|
||||
Reference in New Issue
Block a user