{"action":"created","issue":{"url":"https://api.github.com/repos/jrburke/r.js/issues/696","labels_url":"https://api.github.com/repos/jrburke/r.js/issues/696/labels{/name}","comments_url":"https://api.github.com/repos/jrburke/r.js/issues/696/comments","events_url":"https://api.github.com/repos/jrburke/r.js/issues/696/events","html_url":"https://github.com/jrburke/r.js/issues/696","id":35992118,"number":696,"title":"addModules plugin api to allow plugins to add a module and its dependencies in a layer.","user":{"login":"clmath","id":1646979,"avatar_url":"https://avatars.githubusercontent.com/u/1646979?v=3","gravatar_id":"","url":"https://api.github.com/users/clmath","html_url":"https://github.com/clmath","followers_url":"https://api.github.com/users/clmath/followers","following_url":"https://api.github.com/users/clmath/following{/other_user}","gists_url":"https://api.github.com/users/clmath/gists{/gist_id}","starred_url":"https://api.github.com/users/clmath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clmath/subscriptions","organizations_url":"https://api.github.com/users/clmath/orgs","repos_url":"https://api.github.com/users/clmath/repos","events_url":"https://api.github.com/users/clmath/events{/privacy}","received_events_url":"https://api.github.com/users/clmath/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2014-06-18T14:41:26Z","updated_at":"2015-03-08T18:51:46Z","closed_at":"2014-08-23T18:54:30Z","body":"Hi,\r\n\r\nCurrently, the plugin API only allow to add a module in a layer from a string using the `write` method. This is perfectly fine for simple modules like AMD-wrapped html templates or nls bundles but it is very limited when dealing with real AMD modules.\r\n\r\nA use case for this is the dojo has plugin. This plugin is made to conditionally load a module  or another depending on the environment. During the build, some of this conditions can already be solved, so the plugin know which module to include in the layer.\r\n\r\nThe problem is if the has plugin use the `write` method to include the module, this module's dependencies will not be included in the layer. The `addModules` function would solve this issue by allowing a plugin to directly give to the build the list of mids to be included in the layer with their dependencies.\r\n\r\nHere is the API I propose: \r\n```\r\naddModules(pluginName, resource, addModules)\r\n```\r\n* pluginName: String. The normalized name for the plugin.\r\n\r\n* resource: String. The normalized resource name.\r\n\r\n* addModules: Function. \tA function to be called with an array of normalized module ids. Those modules and their dependencies will be included in the layer.\r\n\r\n\r\nI don't know how hard that would be to implement but I think it would be really helpful."},"comment":{"url":"https://api.github.com/repos/jrburke/r.js/issues/comments/77767267","html_url":"https://github.com/jrburke/r.js/issues/696#issuecomment-77767267","issue_url":"https://api.github.com/repos/jrburke/r.js/issues/696","id":77767267,"user":{"login":"mc007","id":1205100,"avatar_url":"https://avatars.githubusercontent.com/u/1205100?v=3","gravatar_id":"","url":"https://api.github.com/users/mc007","html_url":"https://github.com/mc007","followers_url":"https://api.github.com/users/mc007/followers","following_url":"https://api.github.com/users/mc007/following{/other_user}","gists_url":"https://api.github.com/users/mc007/gists{/gist_id}","starred_url":"https://api.github.com/users/mc007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mc007/subscriptions","organizations_url":"https://api.github.com/users/mc007/orgs","repos_url":"https://api.github.com/users/mc007/repos","events_url":"https://api.github.com/users/mc007/events{/privacy}","received_events_url":"https://api.github.com/users/mc007/received_events","type":"User","site_admin":false},"created_at":"2015-03-08T18:51:46Z","updated_at":"2015-03-08T18:51:46Z","body":"I confirm this too, 'has' plugins are ignored during build time (grunt-requirejs). How to fix this now? Its definitely a show stopper. I was somehow happy to move to requirejs from dojo but now I really don't know how to proceed. \r\nthank you\r\n"}}