Skip to content

Per importare un file .html in Bun come file di testo, usa l'attributo type: "text" nell'istruzione di import.

ts
import html from "./file.html" with { type: "text" };

console.log(html); // <!DOCTYPE html><html><head>...

Questo può anche essere usato con il hot module reloading e/o la watch mode per forzare Bun a ricaricare ogni volta che il file ./file.html cambia.

Bun a cura di www.bunjs.com.cn