fix: guard svg icon loading during docs SSR (#7912)
This commit is contained in:
5
.changeset/small-moons-hunt.md
Normal file
5
.changeset/small-moons-hunt.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@vben/icons": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: guard svg icon loading during docs SSR
|
||||||
@@ -53,6 +53,14 @@ function parseSvg(svgData: string): IconifyIconStructure {
|
|||||||
* <Icon icon="svg:avatar"></Icon>
|
* <Icon icon="svg:avatar"></Icon>
|
||||||
*/
|
*/
|
||||||
async function loadSvgIcons() {
|
async function loadSvgIcons() {
|
||||||
|
if (
|
||||||
|
typeof DOMParser === 'undefined' ||
|
||||||
|
typeof Node === 'undefined' ||
|
||||||
|
typeof XMLSerializer === 'undefined'
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const svgEagers = import.meta.glob('./icons/**', {
|
const svgEagers = import.meta.glob('./icons/**', {
|
||||||
eager: true,
|
eager: true,
|
||||||
query: '?raw',
|
query: '?raw',
|
||||||
|
|||||||
Reference in New Issue
Block a user