Browse Source

fix: guard svg icon loading during docs SSR (#7912)

pull/7919/head
Akuria 5 months ago
committed by GitHub
parent
commit
4d8d2de6ad
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      .changeset/small-moons-hunt.md
  2. 8
      packages/icons/src/svg/load.ts

5
.changeset/small-moons-hunt.md

@ -0,0 +1,5 @@
---
"@vben/icons": patch
---
fix: guard svg icon loading during docs SSR

8
packages/icons/src/svg/load.ts

@ -53,6 +53,14 @@ function parseSvg(svgData: string): IconifyIconStructure {
* <Icon icon="svg:avatar"></Icon>
*/
async function loadSvgIcons() {
if (
typeof DOMParser === 'undefined' ||
typeof Node === 'undefined' ||
typeof XMLSerializer === 'undefined'
) {
return;
}
const svgEagers = import.meta.glob('./icons/**', {
eager: true,
query: '?raw',

Loading…
Cancel
Save