を見つけて、 // ブラウザが実行できる形 (Blob URLへのimport) に書き換える const scriptSrcRegex = /<\/script>/gi; rawHtml = rawHtml.replace(scriptSrcRegex, (match, srcPath) => { // src="/index.tsx" -> import "/index.tsx" (これはImportMapでBlob URLに解決される) // 先頭の.をつけるなどパス正規化 let cleanPath = srcPath; if(!cleanPath.startsWith('.') && !cleanPath.startsWith('/')) cleanPath = "./" + cleanPath; if(!cleanPath.startsWith('.')) cleanPath = "." + cleanPath; // ensure ./ or / return `