FredKSchott / esm-hmr

a Hot Module Replacement (HMR) API for your ESM-based dev server.
MIT License
413 stars 11 forks source link

HMR bubbles up all the way to the entrypoint on simple changes #19

Closed alubbe closed 3 years ago

alubbe commented 3 years ago

We're seeing a lot of page reloads and we don't know what exactly is causing that:

[ESM-HMR] message: update {type: "update", url: "/_dist_/qaz/bar/components/foo/foo.js", bubbled: false}
[ESM-HMR] message: update {type: "update", url: "/_dist_/qaz/bar/containers/asd.js", bubbled: true}
[ESM-HMR] message: update {type: "update", url: "/_dist_/qaz/bar/containers/foo.js", bubbled: true}
[ESM-HMR] message: update {type: "update", url: "/_dist_/qaz/bar/routes.js", bubbled: true}
[ESM-HMR] message: update {type: "update", url: "/_dist_/qaz/bar/meow.js", bubbled: true}
[ESM-HMR] message: update {type: "update", url: "/_dist_/index.js", bubbled: true}
[ESM-HMR] message: reload
[ESM-HMR] message: update {type: "update", url: "/_dist_/qaz/bar/containers/views/a.js", bubbled: true}
[ESM-HMR] message: update {type: "update", url: "/_dist_/qaz/bar/containers/views/b.js", bubbled: true}
[ESM-HMR] message: update {type: "update", url: "/_dist_/qaz/bar/containers/views/c.js", bubbled: true}
[ESM-HMR] message: update {type: "update", url: "/_dist_/qaz/bar/containers/views/d.js", bubbled: true}
[ESM-HMR] message: update {type: "update", url: "/_dist_/qaz/bar/containers/views/e.js", bubbled: true}
[ESM-HMR] message: update {type: "update", url: "/_dist_/qaz/bar/containers/views/f.js", bubbled: true}
[ESM-HMR] message: update {type: "update", url: "/_dist_/qaz/bar/containers/views/x.js", bubbled: true}

We're using snowpack 2.14.3 extending @snowpack/app-scripts-react.

These changes look relatively simple (like changing the text in an h1 element) and they do not cause full page reloads using CRA.

Unfortunately, I cannot put the codebase online, but do you have any pointers for us what might be causing this?

FredKSchott commented 3 years ago

Hmm, that's interesting and sounds unexpected. Can you reproduce in a simple example, like a create-snowpack-app template?

FredKSchott commented 3 years ago

PS: since this is a Snowpack issue, can you re-file on the Snowpack repo? https://github.com/pikapkg/snowpack/discussions