Skip to content

Latest commit

History

History
36 lines (30 loc) 路 647 Bytes

live-reload.md

File metadata and controls

36 lines (30 loc) 路 647 Bytes
order
2

鈿★笍 Live Reload

Miniflare automatically refreshes your browser when your worker script changes when liveReload is set to true.

const mf = new Miniflare({
  liveReload: true,
});

Miniflare will only inject the <script> tag required for live-reload at the end of responses with the Content-Type header set to text/html:

export default {
  fetch() {
    const body = `
      <!DOCTYPE html>
      <html>
      <body>
        <p>Try update me!</p>
      </body>
      </html>
    `;

    return new Response(body, {
      headers: { "Content-Type": "text/html; charset=utf-8" },
    });
  },
};