1async function loadManifest() { 2 const { baseUrl, manifest } = await fetchManifestFromUrl(); 3 const entry = Object.values(manifest).find((e) => e.isEntry); 4 if (!entry) { 5 console.error("No entry found in manifest."); 6 return; 7 } 8 // Load CSS files first 9 (entry.css || []).forEach((cssFile) => { 10 appendResource("link", baseUrl + "/" + cssFile); 11 }); 12 // Load main JS file as module (imports are resolved automatically by the browser) 13 appendResource("script", baseUrl + "/" + entry.file); 14} 15function appendResource(tag, src) { 16 // Duplicate guard â voorkom dubbel laden 17 if (tag === "script" && document.querySelector(`script[src="${src}"]`)) return; 18 if (tag === "link" && document.querySelector(`link[href="${src}"]`)) return; 19 20 const element = document.createElement(tag); 21 if (tag === "script") { 22 element.type = "module"; 23 element.src = src; 24 document.body.appendChild(element); 25 } else if (tag === "link") { 26 element.rel = "stylesheet"; 27 element.href = src; 28 element.type = "text/css"; 29 document.head.appendChild(element); 30 } 31} 32async function fetchManifestFromUrl() { 33 const manifestScript = document.querySelector("script[data-manifest]"); 34 const manifestUrl = manifestScript.getAttribute("data-manifest"); 35 if (!manifestUrl) { 36 console.error('No "data-manifest" attribute found on the manifest script.'); 37 return; 38 } 39 return { 40 baseUrl: new URL(manifestUrl).origin, 41 manifest: await fetch(manifestUrl) 42 .then((response) => response.json()) 43 .then((data) => { 44 return data; 45 }) 46 .catch((error) => { 47 console.error("Error fetching the manifest JSON:", error); 48 }), 49 }; 50} 51loadManifest().then(() => { 52 console.log("Textieldrukshop configurator loaded successfully."); 53});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.