{"action":"opened","issue":{"url":"https://api.github.com/repos/systemjs/builder/issues/724","repository_url":"https://api.github.com/repos/systemjs/builder","labels_url":"https://api.github.com/repos/systemjs/builder/issues/724/labels{/name}","comments_url":"https://api.github.com/repos/systemjs/builder/issues/724/comments","events_url":"https://api.github.com/repos/systemjs/builder/issues/724/events","html_url":"https://github.com/systemjs/builder/issues/724","id":184385111,"number":724,"title":"Common Bundle issue","user":{"login":"mikesnare","id":1864022,"avatar_url":"https://avatars.githubusercontent.com/u/1864022?v=3","gravatar_id":"","url":"https://api.github.com/users/mikesnare","html_url":"https://github.com/mikesnare","followers_url":"https://api.github.com/users/mikesnare/followers","following_url":"https://api.github.com/users/mikesnare/following{/other_user}","gists_url":"https://api.github.com/users/mikesnare/gists{/gist_id}","starred_url":"https://api.github.com/users/mikesnare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikesnare/subscriptions","organizations_url":"https://api.github.com/users/mikesnare/orgs","repos_url":"https://api.github.com/users/mikesnare/repos","events_url":"https://api.github.com/users/mikesnare/events{/privacy}","received_events_url":"https://api.github.com/users/mikesnare/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-21T02:24:20Z","updated_at":"2016-10-21T02:24:20Z","closed_at":null,"body":"I have split my app into several separate bundles and that's working well.  One of my bundles is the 'main' bundle that bootstraps my app and lazily loads other modules as necessary.  All that's working well.\r\n\r\nSeveral of my lazy modules use the same rather large third party dependency, so I'd like to just add that to the main bundle so that the lazy bundles are smaller.\r\n\r\nThe approach I'm trying to take is roughly as follows:\r\n\r\n```js\r\n// First create a bundle of the third party dependencies.\r\nbuilder.bundle('app/dist/app/app/**/* - [app/dist/app/app/**/*]', 'dist/lib/dependencies.js', {minify: true})\r\n\r\n// Now create a bundle containing the main app combined with the dependencies generated above.\r\nbuilder.bundle('app/dist/app/app/main.js + app/dist/lib/dependencies.js', 'dist/lib/bundle.js', {minify: true})\r\n\r\n// Now create the lazy bundles, hopefully minus anything that's already in the main bundle\r\nbuilder.bundle('someLazyModule.js - app/dist/lib/bundle.js', 'dist/lib/someLazyModule.js', {minify: true})\r\n```\r\n\r\n(Note that the above steps are chained so that each step only begins when the previous step is complete)\r\n\r\nStep one works.  The third party bundle looks to be correct.\r\n\r\nStep two fails (stack trace below).\r\n\r\nStep 3 (and beyond for other lazy modules) works providing that in step two I do not attempt to add the third party code to the main bundle.\r\n\r\nWhat am I doing wrong?  From the README it seems like this should work.\r\n\r\n```\r\nTypeError: Cannot read property 'forEach' of undefined\r\n    at Trace.getLoadDependencies (app/node_modules/systemjs-builder/lib/trace.js:934:12)\r\n    at traverseTree (app/node_modules/systemjs-builder/lib/arithmetic.js:377:16)\r\n    at app/node_modules/systemjs-builder/lib/arithmetic.js:382:9\r\n    at Array.forEach (native)\r\n    at traverseTree (app/node_modules/systemjs-builder/lib/arithmetic.js:380:10)\r\n    at app/node_modules/systemjs-builder/lib/arithmetic.js:382:9\r\n    at Array.forEach (native)\r\n    at traverseTree (app/node_modules/systemjs-builder/lib/arithmetic.js:380:10)\r\n    at app/node_modules/systemjs-builder/lib/compile.js:156:5\r\n    at Array.forEach (native)\r\n    at getTreeModulesPostOrder (app/node_modules/systemjs-builder/lib/compile.js:155:14)\r\n    at compileTree (app/node_modules/systemjs-builder/lib/compile.js:269:17)\r\n    at app/node_modules/systemjs-builder/lib/builder.js:700:14\r\n    at tryCatcher (app/node_modules/systemjs-builder/node_modules/bluebird/js/release/util.js:16:23)\r\n    at Promise._settlePromiseFromHandler (app/node_modules/systemjs-builder/node_modules/bluebird/js/release/promise.js:510:31)\r\n    at Promise._settlePromise (app/node_modules/systemjs-builder/node_modules/bluebird/js/release/promise.js:567:18)\r\n```\r\n\r\n"}}
{"actor":{"display_login":"mikesnare"}}