@@ -7,33 +7,33 @@ exports[`load > doesn't load modulepreload polyfill when format is cjs 1`] = `
77
88exports [` load > loads modulepreload polyfill 1` ] = `
99"(function polyfill() {
10- const relList = document .createElement (" link" ).relList ;
11- if (relList && relList .supports && relList .supports (" modulepreload" )) return ;
12- for (const link of document .querySelectorAll (' link[rel="modulepreload"] ' )) processPreload (link );
13- new MutationObserver ((mutations ) => {
14- for (const mutation of mutations ) {
15- if (mutation .type !== " childList" ) continue ;
16- for (const node of mutation .addedNodes ) if (node .tagName === " LINK" && node .rel === " modulepreload" ) processPreload (node );
17- }
18- }).observe (document , {
19- childList: true ,
20- subtree: true
21- });
22- function getFetchOpts(link ) {
23- const fetchOpts = {};
24- if (link .integrity ) fetchOpts .integrity = link .integrity ;
25- if (link .referrerPolicy ) fetchOpts .referrerPolicy = link .referrerPolicy ;
26- if (link .crossOrigin === " use-credentials" ) fetchOpts .credentials = " include" ;
27- else if (link .crossOrigin === " anonymous" ) fetchOpts .credentials = " omit" ;
28- else fetchOpts .credentials = " same-origin" ;
29- return fetchOpts ;
30- }
31- function processPreload(link ) {
32- if (link .ep ) return ;
33- link .ep = true ;
34- const fetchOpts = getFetchOpts (link );
35- fetch (link .href , fetchOpts );
36- }
10+ const relList = document .createElement (" link" ).relList ;
11+ if (relList && relList .supports && relList .supports (" modulepreload" )) return ;
12+ for (const link of document .querySelectorAll (" link[rel=\\ " modulepreload \\ " ] " )) processPreload (link );
13+ new MutationObserver ((mutations ) => {
14+ for (const mutation of mutations ) {
15+ if (mutation .type !== " childList" ) continue ;
16+ for (const node of mutation .addedNodes ) if (node .tagName === " LINK" && node .rel === " modulepreload" ) processPreload (node );
17+ }
18+ }).observe (document , {
19+ childList: true ,
20+ subtree: true
21+ });
22+ function getFetchOpts(link ) {
23+ const fetchOpts = {};
24+ if (link .integrity ) fetchOpts .integrity = link .integrity ;
25+ if (link .referrerPolicy ) fetchOpts .referrerPolicy = link .referrerPolicy ;
26+ if (link .crossOrigin === " use-credentials" ) fetchOpts .credentials = " include" ;
27+ else if (link .crossOrigin === " anonymous" ) fetchOpts .credentials = " omit" ;
28+ else fetchOpts .credentials = " same-origin" ;
29+ return fetchOpts ;
30+ }
31+ function processPreload(link ) {
32+ if (link .ep ) return ;
33+ link .ep = true ;
34+ const fetchOpts = getFetchOpts (link );
35+ fetch (link .href , fetchOpts );
36+ }
3737} )();
3838"
3939` ;
0 commit comments