const loadCss = function(url) { const fileRef = document.createElement('link') fileRef.setAttribute('rel', 'stylesheet') fileRef.setAttribute('type', 'text/css') fileRef.setAttribute('href', url) document.head.appendChild(fileRef) } // const preload = function(url) { // const fileRef = document.createElement('link') // fileRef.setAttribute('rel', 'preload') // fileRef.setAttribute('as', 'script') // fileRef.setAttribute('href', url) // document.head.appendChild(fileRef) // } ;(function() { const css = globalThis.$externals.map(e => e.css).filter(e => e) for (const item of css) { let url = item if (window.$env && window.$env.CDN_MAP) { for (const key in window.$env.CDN_MAP) { if (item.includes(key)) { url = item.replace(key, $env.CDN_MAP[key]) break } } } loadCss(url) } // for (const item of js) { // preload(item) // } })()