Skip to content

Bun 에서 .html 파일을 텍스트 파일로 가져오려면 import 문에서 type: "text" 속성을 사용하세요.

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

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

이는 핫 모듈 리로딩 및/또는 워치 모드와 함께 사용하여 ./file.html 파일이 변경될 때마다 Bun 이 다시 로드하도록 강제할 수도 있습니다.

Bun by www.bunjs.com.cn 편집