Skip to content

Commit

Permalink
Fix random HMR failures
Browse files Browse the repository at this point in the history
Hot module reloading would freeze as soon as it encountered any
compilation error. So when introducing a compilation error (e.g., a
missing semicolon for a CSS rule) and then saving, the HMR is just
frozen. Even if you fix the compilation error by adding the semicolon,
it remains frozen, meaning that I often think that my CSS is wrong, even
when it's not.

What this line of code does is just does a refresh of the page whenever
a change is encountered. Nothing fancy, and it means that it works
predictably.

Similar issue but related to Elm instead of CSS:
parcel-bundler/parcel#6124
  • Loading branch information
veyndan committed Aug 8, 2024
1 parent 7ea5ed5 commit dff7364
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ import {CheckerLegacy} from "./checker.js";
import {Bar, Point, Position} from "./position.js";
import Player from "./player.js";

// https://github.com/parcel-bundler/parcel/pull/443#issuecomment-354583425
if (module.hot) {
module.hot.accept(function () {
window.location.reload();
});
}

/**
* https://rwaldron.github.io/proposal-math-extensions/#sec-math.clamp
*
Expand Down

0 comments on commit dff7364

Please sign in to comment.