hotfix: production source map being ignored

This commit is contained in:
Fuma Nama
2025-05-26 21:30:04 +08:00
parent 0a90cb9331
commit e72b7b4a0b
2 changed files with 21 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-ui': patch
---
hotfix: production source map being ignored
@@ -45,7 +45,22 @@ export function HideIfEmpty({ children }: { children: React.ReactNode }) {
};
}, []);
const inject = `{${isEmpty.toString()}
const inject = `{
function isEmpty(node) {
for (let i = 0; i < node.childNodes.length; i++) {
const child = node.childNodes.item(i);
if (child.nodeType === Node.TEXT_NODE) {
return false;
} else if (
child.nodeType === Node.ELEMENT_NODE &&
window.getComputedStyle(child).display !== 'none'
) {
return false;
}
}
return true;
}
const element = document.querySelector('[data-fdid="${id}"]')
if (element) {