mirror of
https://github.com/iconify/iconify.git
synced 2024-12-12 05:37:49 +00:00
chore(utils): use autoInstall only for last cwd in node loader
This commit is contained in:
parent
c2a76b13ac
commit
5ff09d6936
@ -17,12 +17,12 @@ export const loadNodeIcon: UniversalIconLoader = async (
|
||||
|
||||
const cwds = Array.isArray(options?.cwd) ? options.cwd : [options?.cwd];
|
||||
|
||||
for (const cwd of cwds) {
|
||||
for (let i = 0; i < cwds.length; i++) {
|
||||
const iconSet = await loadCollectionFromFS(
|
||||
collection,
|
||||
options?.autoInstall,
|
||||
i === cwds.length - 1 ? options?.autoInstall : false,
|
||||
undefined,
|
||||
cwd
|
||||
cwds[i]
|
||||
);
|
||||
if (iconSet) {
|
||||
result = await searchForIcon(
|
||||
@ -31,13 +31,13 @@ export const loadNodeIcon: UniversalIconLoader = async (
|
||||
getPossibleIconNames(icon),
|
||||
options
|
||||
);
|
||||
if (result) break;
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!result && options?.warn) {
|
||||
if (options?.warn) {
|
||||
warnOnce(`failed to load ${options.warn} icon`);
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
@ -187,6 +187,8 @@ export type IconifyLoaderOptions = {
|
||||
*
|
||||
* Only used on `node` environment.
|
||||
*
|
||||
* If value is an array and `autoInstall` is enabled, `autoInstall` will be used only for last entry.
|
||||
*
|
||||
* @default process.cwd()
|
||||
*/
|
||||
cwd?: string | string[];
|
||||
|
Loading…
Reference in New Issue
Block a user