Skip to content

Commit 912f888

Browse files
fix: 尝试修复 nuxt 报错 issue#4409
1 parent c803ed7 commit 912f888

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/editor/src/utils/node-polyfill.ts

+7
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,11 @@ if (typeof global === 'object') {
3030
},
3131
}
3232
}
33+
34+
if (global.document != null) {
35+
// SSR 环境下可能会报错 (issue 4409)
36+
if (global.document.getElementsByTagName == null) {
37+
global.document.getElementsByTagName = () => []
38+
}
39+
}
3340
}

0 commit comments

Comments
 (0)