{"action":"created","issue":{"url":"https://api.github.com/repos/systemjs/builder/issues/87","labels_url":"https://api.github.com/repos/systemjs/builder/issues/87/labels{/name}","comments_url":"https://api.github.com/repos/systemjs/builder/issues/87/comments","events_url":"https://api.github.com/repos/systemjs/builder/issues/87/events","html_url":"https://github.com/systemjs/builder/issues/87","id":58406983,"number":87,"title":"injecting dynamic imports","user":{"login":"jschr","id":1163252,"avatar_url":"https://avatars.githubusercontent.com/u/1163252?v=3","gravatar_id":"","url":"https://api.github.com/users/jschr","html_url":"https://github.com/jschr","followers_url":"https://api.github.com/users/jschr/followers","following_url":"https://api.github.com/users/jschr/following{/other_user}","gists_url":"https://api.github.com/users/jschr/gists{/gist_id}","starred_url":"https://api.github.com/users/jschr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jschr/subscriptions","organizations_url":"https://api.github.com/users/jschr/orgs","repos_url":"https://api.github.com/users/jschr/repos","events_url":"https://api.github.com/users/jschr/events{/privacy}","received_events_url":"https://api.github.com/users/jschr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-02-20T20:36:17Z","updated_at":"2015-02-22T11:12:09Z","closed_at":null,"body":"I've been trying to tackle porting a project that used requirejs over to systemjs and being new to systemjs I ran into a snag.\r\n\r\nLong story short, I'm trying to use the systemjs builder to dynamically create a build file that will inject imports into the main module based on a user request . I was able to accomplish this by hooking into the [onBuildRead](https://github.com/jrburke/r.js/blob/master/build/example.build.js#L544) function in requirejs where my main module file looked something like:\r\n\r\n```js\r\nvar dep1 = require('dep1')\r\n// other dependencies injected here by build\r\nvar otherDeps = {{ depsInjectedByServer }};\r\n\r\n// to stuff with otherDeps and otherDeps to sub modules\r\n```\r\n\r\nIs there anyway I can accomplish this with systemjs?\r\n\r\nI looked at the systemjs plugin api but I don't think it would suffice as I would need to pass along the user parameters to the translate.\r\n\r\nHopefully I explained what I'm doing clear enough. \r\n\r\nThanks."},"comment":{"url":"https://api.github.com/repos/systemjs/builder/issues/comments/75430466","html_url":"https://github.com/systemjs/builder/issues/87#issuecomment-75430466","issue_url":"https://api.github.com/repos/systemjs/builder/issues/87","id":75430466,"user":{"login":"guybedford","id":598730,"avatar_url":"https://avatars.githubusercontent.com/u/598730?v=3","gravatar_id":"","url":"https://api.github.com/users/guybedford","html_url":"https://github.com/guybedford","followers_url":"https://api.github.com/users/guybedford/followers","following_url":"https://api.github.com/users/guybedford/following{/other_user}","gists_url":"https://api.github.com/users/guybedford/gists{/gist_id}","starred_url":"https://api.github.com/users/guybedford/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/guybedford/subscriptions","organizations_url":"https://api.github.com/users/guybedford/orgs","repos_url":"https://api.github.com/users/guybedford/repos","events_url":"https://api.github.com/users/guybedford/events{/privacy}","received_events_url":"https://api.github.com/users/guybedford/received_events","type":"User","site_admin":false},"created_at":"2015-02-22T11:12:09Z","updated_at":"2015-02-22T11:12:09Z","body":"Ah right I think I see what you mean - you should be able to use the builder arithmetic to generate custom bundles containing what you need. See https://github.com/systemjs/builder#example---exclusion, you could effectively do the same for addition of trees.\r\n\r\nAlternatively you could generate the initial main entry point before running builder, containing the imports you need and then run that through the builder perhaps."}}