mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-12-03 16:59:42 +00:00
fix(packages): ship ESM type declarations for Solid packages (#5263)
`lucide-solid` and `@lucide/solid` have no `"type": "module"` and point every `types` export condition at `.d.ts` files, so TypeScript's Node16/NodeNext resolution reads the declarations as CommonJS. ESM consumers then get the module object instead of the component for per-icon default imports (`import Camera from '@lucide/solid/icons/camera'`), failing with TS2604/TS2322. Emit `.d.mts` declarations next to the existing `.d.ts` files (rollup rewrites their relative imports to `.mjs`) and select them via a nested `import` condition under `types`, as lucide-react already does with `.d.mts` files. The `.d.ts` files, top-level `types` field and runtime conditions are unchanged.
This commit is contained in:
@@ -32,21 +32,30 @@
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/types/lucide-solid.d.ts",
|
||||
"types": {
|
||||
"import": "./dist/types/lucide-solid.d.mts",
|
||||
"default": "./dist/types/lucide-solid.d.ts"
|
||||
},
|
||||
"solid": "./dist/source/lucide-solid.jsx",
|
||||
"import": "./dist/esm/lucide-solid.mjs",
|
||||
"browser": "./dist/esm/lucide-solid.mjs",
|
||||
"require": "./dist/cjs/lucide-solid.js"
|
||||
},
|
||||
"./icons": {
|
||||
"types": "./dist/types/lucide-solid.d.ts",
|
||||
"types": {
|
||||
"import": "./dist/types/lucide-solid.d.mts",
|
||||
"default": "./dist/types/lucide-solid.d.ts"
|
||||
},
|
||||
"solid": "./dist/source/lucide-solid.jsx",
|
||||
"import": "./dist/esm/lucide-solid.mjs",
|
||||
"browser": "./dist/esm/lucide-solid.mjs",
|
||||
"require": "./dist/cjs/lucide-solid.js"
|
||||
},
|
||||
"./icons/*": {
|
||||
"types": "./dist/types/icons/*.d.ts",
|
||||
"types": {
|
||||
"import": "./dist/types/icons/*.d.mts",
|
||||
"default": "./dist/types/icons/*.d.ts"
|
||||
},
|
||||
"solid": "./dist/source/icons/*.jsx",
|
||||
"import": "./dist/esm/icons/*.mjs",
|
||||
"browser": "./dist/esm/icons/*.mjs",
|
||||
|
||||
Reference in New Issue
Block a user