Skip to content

Commit

Permalink
fix: only apply modulepreload polyfill when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed Jul 1, 2021
1 parent 733975e commit b1505a3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/vite/src/node/plugins/modulePreloadPolyfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ declare const MutationObserver: any
declare const fetch: any

function polyfill() {
const relList = document.createElement('link').relList
if (relList && relList.supports && relList.supports('modulepreload')) {
return
}

for (const link of document.querySelectorAll('link[rel="modulepreload"]')) {
processPreload(link)
}
Expand Down

0 comments on commit b1505a3

Please sign in to comment.