benjamn / install

Minimal JavaScript module loader

Home Page:https://benjamn.github.io/install/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Replace file

Akryum opened this issue · comments

I don't see a way to replace a file with new content (for example, to hot reload modules). Is it currently possible?
Maybe we could have an option like forceReplace?

Here's the line where we ignore new contents for files that have already been installed.

I'm definitely interested in this idea, and my use case is the same as yours (hot module replacement). I wonder what minimal hooks we could support to enable hot module replacement, so that we don't have to implement that logic in this package. At minimum, I think we should reuse the module object from the previous version of the module.

What I'm trying to do is replace an installed file with meteorInstall. Currently, my workaround is to change the filename with a timestamp, but this leads to unexpected side effects.

@benjamn I known that it is about 3 years old topic. But maybe you have any ideas how to do it properly? Any idea about hooks?