Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dynamically generated files at runtime #54

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jamesgibson14
Copy link

@jamesgibson14 jamesgibson14 commented Jan 11, 2019

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?

@jamesgibson14 jamesgibson14 changed the title add files at dynamically generated files runtime add dynamically generated files at runtime Jan 11, 2019
@benjamn
Copy link
Owner

benjamn commented Feb 3, 2019

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 #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.

@jamesgibson14
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants