Hot reload doesn’t work for an empty HTML page without external CSS/JS imports

🐛 bug report

No files or configs

🤔 Expected Behavior

I have empty HTML without any external resources (such as local CSS files or JS). When I change it and save I should get an immediate update in the browser without refresh while in dev mode.

😯 Current Behavior

I change anything in the HTML file, it gets rebuilt but not refreshed automatically in the browser. I need to click refresh.

💁 Possible Solution

When I add any import. For example to the CSS external local file and then refresh the page once, all changes to HTML start to immediately displayed on saving without a need to press refresh

💻 Code Sample

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<p style="color: red">Hello world</p>
</body>
</html>

🌍 Your Environment

Software Version(s)
Parcel latest to date
Node 8.9.3
Yarn 1.5
Operating System Mac OS High Sierra

1 possible answer(s) on “Hot reload doesn’t work for an empty HTML page without external CSS/JS imports

  1. There is no javascript bundle to append the HMR runtime to.

    if (this.options.hmr) {
    let asset = await this.bundler.getAsset(
    require.resolve(‘../builtins/hmr-runtime’)
    );
    await this.addAssetToBundle(asset);
    entry.push(asset.id);
    }

    We would have to inject a script tag into the html file.