Add override alias import entry files lucide-react

This commit is contained in:
Eric Fennis
2024-01-27 22:47:17 +01:00
parent 3302870983
commit b875ee1a52
4 changed files with 48 additions and 0 deletions

View 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";
}
```

View File

@@ -98,5 +98,12 @@ export default [
}], }],
plugins: [dts()], plugins: [dts()],
}, },
{
input: 'src/lucide-react.prefixed.ts',
output: [{
file: `dist/lucide-react.prefixed.d.ts`, format: "es"
}],
plugins: [dts()],
},
...configs ...configs
]; ];

View 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';

View 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';