{"action":"created","issue":{"url":"https://api.github.com/repos/MeteorCommunity/discussions/issues/27","labels_url":"https://api.github.com/repos/MeteorCommunity/discussions/issues/27/labels{/name}","comments_url":"https://api.github.com/repos/MeteorCommunity/discussions/issues/27/comments","events_url":"https://api.github.com/repos/MeteorCommunity/discussions/issues/27/events","html_url":"https://github.com/MeteorCommunity/discussions/issues/27","id":52323123,"number":27,"title":"Lazy Loading of Client Resources","user":{"login":"hitchcott","id":1696942,"avatar_url":"https://avatars.githubusercontent.com/u/1696942?v=3","gravatar_id":"","url":"https://api.github.com/users/hitchcott","html_url":"https://github.com/hitchcott","followers_url":"https://api.github.com/users/hitchcott/followers","following_url":"https://api.github.com/users/hitchcott/following{/other_user}","gists_url":"https://api.github.com/users/hitchcott/gists{/gist_id}","starred_url":"https://api.github.com/users/hitchcott/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hitchcott/subscriptions","organizations_url":"https://api.github.com/users/hitchcott/orgs","repos_url":"https://api.github.com/users/hitchcott/repos","events_url":"https://api.github.com/users/hitchcott/events{/privacy}","received_events_url":"https://api.github.com/users/hitchcott/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/MeteorCommunity/discussions/labels/Isobuild","name":"Isobuild","color":"5319e7"},{"url":"https://api.github.com/repos/MeteorCommunity/discussions/labels/Meteor+Build","name":"Meteor Build","color":"5319e7"},{"url":"https://api.github.com/repos/MeteorCommunity/discussions/labels/Webapp","name":"Webapp","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2014-12-18T03:57:08Z","updated_at":"2015-01-21T12:20:50Z","closed_at":null,"body":"One limitation of Meteor is that you can't choose which resources are bundled to the client based on their session state. As far as I can tell, the client always receives 'all or nothing' of the application (apart from `/public`, or translation strings if you're using `tap:i18n`).\r\n\r\nFor example, a common pattern is to have an `/admin/` route, which most users don't visit, but all of the resources are shipped to all clients anyway. A minor redundancy issue, but for much larger apps at scale, I imagine this could have a substantial effect.\r\n\r\nI believe the only way to achieve the separation of what is shipped right now is to have multiple meteor instances running on different ports, but attached to the same database -- e.g. at `admin.myapp.com` and `www.myapp.com`. I think it would be cleaner to avoid this.\r\n\r\nFor me the ideal folder structure of such an app would look something like:\r\n\r\n```\r\n/modules/admin/content/ \r\n/modules/frontend/posts/\r\n/modules/frontend/comments/\r\n[Perhaps with a special config file that is used during the build process.]\r\n```\r\n\r\nIdeally, this solution may would integrate with iron-router in some way, to simplify which routes trigger the loading of which resources.\r\n\r\nAdditionally, there could be a security benefit - don't ship certain code to certain clients based on allow/deny rules, just like DDP? This way we can ensure that only users logged in to an admin account can even download the admin UI logic.\r\n\r\nI haven't thought too much about the API to achieve this, or even if it's feasible, but I didn't see this being discussed already (apologies if it was), and it'd be great to hear if anyone has thoughts and/or suggestions on how to achieve it."},"comment":{"url":"https://api.github.com/repos/MeteorCommunity/discussions/issues/comments/70827541","html_url":"https://github.com/MeteorCommunity/discussions/issues/27#issuecomment-70827541","issue_url":"https://api.github.com/repos/MeteorCommunity/discussions/issues/27","id":70827541,"user":{"login":"jadsonlourenco","id":1428013,"avatar_url":"https://avatars.githubusercontent.com/u/1428013?v=3","gravatar_id":"","url":"https://api.github.com/users/jadsonlourenco","html_url":"https://github.com/jadsonlourenco","followers_url":"https://api.github.com/users/jadsonlourenco/followers","following_url":"https://api.github.com/users/jadsonlourenco/following{/other_user}","gists_url":"https://api.github.com/users/jadsonlourenco/gists{/gist_id}","starred_url":"https://api.github.com/users/jadsonlourenco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jadsonlourenco/subscriptions","organizations_url":"https://api.github.com/users/jadsonlourenco/orgs","repos_url":"https://api.github.com/users/jadsonlourenco/repos","events_url":"https://api.github.com/users/jadsonlourenco/events{/privacy}","received_events_url":"https://api.github.com/users/jadsonlourenco/received_events","type":"User","site_admin":false},"created_at":"2015-01-21T12:20:50Z","updated_at":"2015-01-21T12:20:50Z","body":"Hi @numtel, just a thought on this: Meteor uses Node, we all know, and Node is not very good to work with \"external\" files, I say this because time ago I put Polymer inside the folder \"public\", but after 30 minutes Meteor work so slow for the auto-reload. Then after Polymer removed from the \"public\" and added as external(cdn) Meteor back to work fast.\r\n\r\nIn this use case will it happen, if you put too many files for Meteor handle these requests, will it become very slow after a few minutes? I will try it now!\r\n\r\nAnother issue, this method works with your other packages that create \"WebComponents\"? I will try it now too.\r\n\r\nBut for both issues if you or someone here has an answer that's great, perhaps explain why you have many files in the \"public\" folder Meteor is slow, etc.\r\n\r\nThank you."}}