Skip to content

Commit be4b0c0

Browse files
authored
fix: check document before detect script rel (#13559)
1 parent 931b24f commit be4b0c0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/vite/src/node/plugins/importAnalysisBuild.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ function indexOfMatchInSlice(
7171
*/
7272

7373
function detectScriptRel() {
74-
const relList = document.createElement('link').relList
74+
const relList =
75+
typeof document !== 'undefined' && document.createElement('link').relList
7576
return relList && relList.supports && relList.supports('modulepreload')
7677
? 'modulepreload'
7778
: 'preload'

0 commit comments

Comments
 (0)