在 Bun 中,使用 type: "text" 屬性將 .html 文件作為文本導入。
ts
import html from "./file.html" with { type: "text" };
console.log(html); // <!DOCTYPE html><html><head>...這也可以與熱模塊重載和/或監聽模式一起使用,以便在 ./file.html 文件更改時強制 Bun 重新加載。