Skip to content

Commit

Permalink
fix: check document before detect script rel (#13559)
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat authored Jul 4, 2023
1 parent 931b24f commit be4b0c0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/vite/src/node/plugins/importAnalysisBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ function indexOfMatchInSlice(
*/

function detectScriptRel() {
const relList = document.createElement('link').relList
const relList =
typeof document !== 'undefined' && document.createElement('link').relList
return relList && relList.supports && relList.supports('modulepreload')
? 'modulepreload'
: 'preload'
Expand Down

0 comments on commit be4b0c0

Please sign in to comment.