2025-02-17 [03:20:52.0716] Hello, I'm thinking about allowing purge(/access to) module import cache in ECMAScript. What do you think about this? [03:23:13.0590] Being able to access the module cache will make HMR easier, without restarting the entire environment or bundling things together. 2025-02-21 [00:22:44.0881] I like it, but i think it's been discussed before. If you do move forward with it, please tag me 😀 [01:01:49.0845] > <@jakobjingleheimer:matrix.org> I like it, but i think it's been discussed before. > > If you do move forward with it, please tag me 😀 Is there a time or reference to the message of that discussion, so I can look for it? [01:30:54.0517] I don't know of one, but there surely is [10:03:25.0994] CyanChanges there were some discussion about that in https://github.com/tc39/proposal-compartments/blob/master/0-module-and-module-source.md (cc Kris Kowal). That proposal wouldn't allow you to modify the module cache, but it would allow you to run some modules in a _clean cache_ that can be partially popupated from an old cache. So you'd be able to re-run a module and its importers, while keeping the old version of all the other branches in the module tree 2025-02-22 [07:26:37.0875] CyanChanges: HMR is specifically one of the cases I hope motivates a Module constructor and possibly even Evaluators [07:28:22.0944] It would at least let you create a virtual cache that overshadows the host ESM cache [07:30:02.0648] > <@kriskowal:aelf.land> It would at least let you create a virtual cache that overshadows the host ESM cache Well, won't that cause memory leak? [07:30:35.0201] The caches will keeps growing. [07:31:38.0464] No, the caches themelves are eligible for collection [07:33:47.0865] So for HMR, you would need to release the previous generation’s module instances when retaining the new root. The usual amount of care is needed only to avoid chaining retention between successive generations [07:34:27.0158] In general, it should be sufficient to drop the root Module when you import the next root [07:36:01.0594] Looks pretty good.