File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
packages/qwik/src/core/qrl Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -101,12 +101,22 @@ export const loadBundleGraph = (element: Element) => {
101101 } ) ;
102102} ;
103103
104+ let canModulePreload : boolean | null = null ;
104105const makePreloadLink = ( bundle : BundleImport , priority : boolean ) => {
105106 const link = document . createElement ( 'link' ) ;
106- link . rel = 'modulepreload' ;
107+ if ( canModulePreload === null ) {
108+ if ( link . relList . supports ( 'modulepreload' ) ) {
109+ canModulePreload = true ;
110+ } else {
111+ canModulePreload = false ;
112+ }
113+ }
114+ link . rel = canModulePreload ? 'modulepreload' : 'preload' ;
107115 link . href = bundle . $url$ ! ;
108116 link . fetchPriority = priority ? 'high' : 'low' ;
109- link . as = 'script' ;
117+ if ( ! canModulePreload ) {
118+ link . as = 'script' ;
119+ }
110120 document . head . appendChild ( link ) ;
111121} ;
112122
You can’t perform that action at this time.
0 commit comments