在 Bun 中,使用 type: "text" 属性将 .html 文件作为文本导入。
ts
import html from "./file.html" with { type: "text" };
console.log(html); // <!DOCTYPE html><html><head>...这也可以与热模块重载和/或监听模式一起使用,以便在 ./file.html 文件更改时强制 Bun 重新加载。