fix: guard svg icon loading during docs SSR (#7912)
parent
294700a247
commit
4d8d2de6ad
|
|
@ -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',
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue