natemoo-re / astro-icon

Inline and sprite-based SVGs in Astro made easy!
https://astroicon.dev
Other
992 stars 57 forks source link

fix(createIconPack): handle unresolved modules #148

Closed kripod closed 7 months ago

kripod commented 8 months ago

When trying to build a site with a custom icon pack using the astro/tsconfigs/strict TSConfig, tsc --noEmit fails:

Error: node_modules/.pnpm/astro-icon@0.8.1/node_modules/astro-icon/lib/createIconPack.ts(18,45): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'. Type 'undefined' is not assignable to type 'string'.  ELIFECYCLE  Command failed with exit code 2.

It turns out that resolvePackage may return undefined, therefore this edge-case should be handled.

changeset-bot[bot] commented 8 months ago

🦋 Changeset detected

Latest commit: fd25e4ecaa5a55e463f1bf839094347c7652b66e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages | Name | Type | | ---------- | ----- | | astro-icon | Patch | | www | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

vercel[bot] commented 8 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-astroicon ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 5, 2023 7:38pm
astroicon ❌ Failed (Inspect) Dec 5, 2023 7:38pm