Skip to content

Commit

Permalink
fix: correct access to crossOrigin attribute (#12023)
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann authored Feb 14, 2023
1 parent e033e49 commit 6a0d356
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/vite/src/node/plugins/modulePreloadPolyfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ function polyfill() {
}
}).observe(document, { childList: true, subtree: true })

function getFetchOpts(script: any) {
function getFetchOpts(link: any) {
const fetchOpts = {} as any
if (script.integrity) fetchOpts.integrity = script.integrity
if (script.referrerpolicy) fetchOpts.referrerPolicy = script.referrerpolicy
if (script.crossorigin === 'use-credentials')
if (link.integrity) fetchOpts.integrity = link.integrity
if (link.referrerPolicy) fetchOpts.referrerPolicy = link.referrerPolicy
if (link.crossOrigin === 'use-credentials')
fetchOpts.credentials = 'include'
else if (script.crossorigin === 'anonymous') fetchOpts.credentials = 'omit'
else if (link.crossOrigin === 'anonymous') fetchOpts.credentials = 'omit'
else fetchOpts.credentials = 'same-origin'
return fetchOpts
}
Expand Down

0 comments on commit 6a0d356

Please sign in to comment.