11 ms·
Because you were never really reloading it, you were loading a second copy of it (and praying the old one gets garbage collected). "Delete it from the cache" do
by bastawhiz 4y ago
Because you were never really reloading it, you were loading a second copy of it (and praying the old one gets garbage collected). "Delete it from the cache" doesn't stop timers, clean up event listeners, remove references held in memory, etc. It just removes the reference to the module that the require method holds. You were never reloading in the first place, just swapping out a reference. Arguably, this was hackier than the hacks you suggest now, since it's less explicit that you might not be accomplishing what you hope to.