install
install copied to clipboard
add dynamically generated files at runtime
Hi Ben, This is to dynamically "install" code/template at run time, which overcomes the typical meteor compile "bug" (in my eyes it is a bug) where a list of dynamically importable files are stored at build/compile time. I have been using this code for a couple of years now and it works great. I can change my entire app based off of any config, domain, host, ect. On the server side of Meteor I hacked Dynamic-imports to export the file cache and I can compile code and add it to the cache, then with this PR I can import it from the client by making it think there are a lot more files in the /imports/ directory or wherever.
I don't know if you would ever add something like to the main repository, but could you take a look at it and let me know what you think?
Sorry for the delay!
I think we should support a way of calling the install function (aka meteorInstall in Meteor) that allows replacing existing modules, rather than adding a new require.addFiles function to every require function. See https://github.com/benjamn/install/issues/10 for more discussion.
As you pointed out, implementing module replacement in this library doesn't automatically mean Meteor will be able to take advantage of it, since changes would be required in Meteor. But I'm open to enabling experimentation.
Yes, I also open to any method of generating references to dynamic runtime files, my PR works but I don't claim to understand the whole makeInstall function. I am willing to help with and test any ideas you have. I like the way the object passed to makeInstall creates scope and reference for the files which is why hacked it with my PR instead of just observing a mongo collection on the client and eval'ing the code there, which is what I was doing before my PR.