Skip to content

Para importar um arquivo .html no Bun como um arquivo de texto, use o atributo type: "text" na instrução de import.

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

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

Isso também pode ser usado com hot module reloading e/ou modo watch para forçar o Bun a recarregar sempre que o arquivo ./file.html for alterado.

Bun by www.bunjs.com.cn edit