diff --git a/.changeset/two-lizards-double.md b/.changeset/two-lizards-double.md new file mode 100644 index 0000000..8ff3765 --- /dev/null +++ b/.changeset/two-lizards-double.md @@ -0,0 +1,5 @@ +--- +"astro-icon": patch +--- + +Removes an unecessary warning when only using local icons diff --git a/packages/core/src/vite-plugin-astro-icon.ts b/packages/core/src/vite-plugin-astro-icon.ts index 4d246d9..08d778e 100644 --- a/packages/core/src/vite-plugin-astro-icon.ts +++ b/packages/core/src/vite-plugin-astro-icon.ts @@ -34,7 +34,6 @@ export function createPlugin( if (id === resolvedVirtualModuleId) { if (!collections) { collections = await loadIconifyCollections({ root, include }); - logCollections(collections, ctx); } try { // Attempt to create local collection @@ -43,6 +42,7 @@ export function createPlugin( } catch (ex) { // Failed to load the local collection } + logCollections(collections, { ...ctx, iconDir }); await generateIconTypeDefinitions(Object.values(collections), root); return `export default ${JSON.stringify( @@ -55,13 +55,16 @@ export function createPlugin( function logCollections( collections: AstroIconCollectionMap, - { logger }: PluginContext, + { logger, iconDir }: PluginContext & { iconDir: string }, ) { if (Object.keys(collections).length === 0) { logger.warn("No icons detected!"); return; } - const names: string[] = Object.keys(collections); + const names: string[] = Object.keys(collections).filter(v => v !== 'local'); + if (collections['local']) { + names.unshift(iconDir); + } logger.info(`Loaded icons from ${names.join(", ")}`); }