HMR bug? Shared dependencies can get duplicated on update #2238
Unanswered
rixo
asked this question in
Troubleshooting
Replies: 1 comment
-
Fixed it by ensuring all modules impacted by a HMR update are reloaded with the same main...rixo:hmr-fix-module-duplication Also had to adapt the test for the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In a fresh minimal CSA app, with a file layout like this:
Dependencies like such:
If I have an accept handler in index, and change transitive, then every module gets reloaded once, and I get what I expect.
However, if the accept handlers are in a and b (e.g. situation I would get if a and b were Svelte components), and a change happens in transitive (not accepted), then transitive is reloaded twice. a and b each get a different copy, which can easily lead to a broken app, because modules are expected to be unique.
My expectation would be that the transitive module gets reloaded, but only once, and a and b would get the same copy of their shared dependency.
Is my expectation correct? Should we attempt to fix this? (Any pointer?)
Example reproduction
Snowpack version: 2.18.4
index.js
a.js
b.js
transitive.js
Steps
open the page
see expected output in the console:
... where XXX is the same value.
save
transitive.js
see incorrect output in the console:
... where YYY and ZZZ are different values, but they should be the same.
Beta Was this translation helpful? Give feedback.
All reactions