|
94 | 94 | } |
95 | 95 | ]); |
96 | 96 |
|
97 | | - $effect.pre(() => { |
98 | | - const donationPlatforms = [ |
99 | | - { key: 'PUBLIC_BUY_ME_A_COFFEE', name: 'Buy Me A Coffee', path: 'SiBuymeacoffee' }, |
100 | | - { key: 'PUBLIC_LIBERAPAY', name: 'Liberapay', path: 'SiLiberapay' }, |
101 | | - { key: 'PUBLIC_KO_FI', name: 'Ko-Fi', path: 'SiKofi' }, |
102 | | - { key: 'PUBLIC_PATREON', name: 'Patreon', path: 'SiPatreon' } |
103 | | - ]; |
| 97 | + const donationPlatforms = [ |
| 98 | + { |
| 99 | + key: 'PUBLIC_BUY_ME_A_COFFEE', |
| 100 | + name: 'Buy Me A Coffee', |
| 101 | + iconModule: await import('@icons-pack/svelte-simple-icons/icons/SiBuymeacoffee') |
| 102 | + }, |
| 103 | + { |
| 104 | + key: 'PUBLIC_LIBERAPAY', |
| 105 | + name: 'Liberapay', |
| 106 | + iconModule: await import('@icons-pack/svelte-simple-icons/icons/SiLiberapay') |
| 107 | + }, |
| 108 | + { |
| 109 | + key: 'PUBLIC_KO_FI', |
| 110 | + name: 'Ko-Fi', |
| 111 | + iconModule: await import('@icons-pack/svelte-simple-icons/icons/SiKofi') |
| 112 | + }, |
| 113 | + { |
| 114 | + key: 'PUBLIC_PATREON', |
| 115 | + name: 'Patreon', |
| 116 | + iconModule: await import('@icons-pack/svelte-simple-icons/icons/SiPatreon') |
| 117 | + } |
| 118 | + ]; |
104 | 119 |
|
105 | | - donationPlatforms.forEach(async ({ key, name, path }) => { |
| 120 | + $effect.pre(() => { |
| 121 | + donationPlatforms.forEach(({ key, name, iconModule }) => { |
106 | 122 | const href = (env as Record<string, string | undefined>)[key]; |
107 | 123 |
|
| 124 | + // Check if the environment variable exists and isn't already in the list |
108 | 125 | if (href && !footerLinks.some((link) => link.href === href)) { |
109 | | - const module = await import( |
110 | | - `@icons-pack/svelte-simple-icons/icons/${path}.svelte` /* @vite-ignore */ |
111 | | - ); |
112 | | -
|
113 | 126 | footerLinks.push({ |
114 | 127 | href, |
115 | 128 | name, |
116 | | - icon: module.default, |
| 129 | + // Use the .default property from the awaited import |
| 130 | + icon: iconModule.default, |
117 | 131 | order: footerLinks.length + 1 |
118 | 132 | }); |
119 | 133 | } |
|
0 commit comments