{"action":"created","issue":{"url":"https://api.github.com/repos/reducejs/common-bundle/issues/8","repository_url":"https://api.github.com/repos/reducejs/common-bundle","labels_url":"https://api.github.com/repos/reducejs/common-bundle/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/reducejs/common-bundle/issues/8/comments","events_url":"https://api.github.com/repos/reducejs/common-bundle/issues/8/events","html_url":"https://github.com/reducejs/common-bundle/issues/8","id":151416155,"number":8,"title":"Is there any way to emulate factor-bundle and create a single common bundle?","user":{"login":"wc-matteo","id":10562635,"avatar_url":"https://avatars.githubusercontent.com/u/10562635?v=3","gravatar_id":"","url":"https://api.github.com/users/wc-matteo","html_url":"https://github.com/wc-matteo","followers_url":"https://api.github.com/users/wc-matteo/followers","following_url":"https://api.github.com/users/wc-matteo/following{/other_user}","gists_url":"https://api.github.com/users/wc-matteo/gists{/gist_id}","starred_url":"https://api.github.com/users/wc-matteo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wc-matteo/subscriptions","organizations_url":"https://api.github.com/users/wc-matteo/orgs","repos_url":"https://api.github.com/users/wc-matteo/repos","events_url":"https://api.github.com/users/wc-matteo/events{/privacy}","received_events_url":"https://api.github.com/users/wc-matteo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-04-27T15:31:02Z","updated_at":"2016-04-28T07:42:51Z","closed_at":null,"body":"A single common bundle even if the module is not required by all original bundles (i.e. have a custom threshold).\r\n\r\nI've tried various things with little success... if there's no simple way, do you have any idea how much work would take to have `factor-bundle` play nice with this plugin? I also tried that, but wasn't particularly successful either..."},"comment":{"url":"https://api.github.com/repos/reducejs/common-bundle/issues/comments/215337417","html_url":"https://github.com/reducejs/common-bundle/issues/8#issuecomment-215337417","issue_url":"https://api.github.com/repos/reducejs/common-bundle/issues/8","id":215337417,"user":{"login":"zoubin","id":2097644,"avatar_url":"https://avatars.githubusercontent.com/u/2097644?v=3","gravatar_id":"","url":"https://api.github.com/users/zoubin","html_url":"https://github.com/zoubin","followers_url":"https://api.github.com/users/zoubin/followers","following_url":"https://api.github.com/users/zoubin/following{/other_user}","gists_url":"https://api.github.com/users/zoubin/gists{/gist_id}","starred_url":"https://api.github.com/users/zoubin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zoubin/subscriptions","organizations_url":"https://api.github.com/users/zoubin/orgs","repos_url":"https://api.github.com/users/zoubin/repos","events_url":"https://api.github.com/users/zoubin/events{/privacy}","received_events_url":"https://api.github.com/users/zoubin/received_events","type":"User","site_admin":false},"created_at":"2016-04-28T07:42:51Z","updated_at":"2016-04-28T07:42:51Z","body":"Actually, the `common` option is used to set the dependency relationship between bundles.\r\nIf bundle `a.js` is declared to depend on `b.js`, modules in `b.js` should not be included in `a.js`, because 'depend' means that `b.js` should be loaded before `a.js`, no need to load them again from `a.js`.\r\nHowever, if `b.js` does not exist yet, it should be created and contain the common modules shared by its dependents in the current configure.\r\n\r\n```js\r\ncommon: [\r\n  // Declare that both a.js and b.js should depend on common.js\r\n  // As common.js does not exist, it is created to contain modules shared\r\n // by both a.js and b.js\r\n  {\r\n    output: 'lib/common.js',\r\n    filter: ['lib/a.js', 'lib/b.js']\r\n  },\r\n\r\n  // Declare that a.js and c.js should depend on common.js\r\n  // As common.js already exists, no extra bundle need to be created\r\n  // But modules in c.js are removed if they are also in common.js\r\n  // Since a.js has already been declared to depend on common.js in the previous\r\n  // configure, nothing will happen to it here\r\n  // In a word, this configure will NOT modify the contents of common.js\r\n  // It only removes some modules from c.js\r\n  {\r\n    output: 'lib/common.js',\r\n    filter: ['lib/a.js', 'lib/c.js']\r\n  },\r\n\r\n  // declare that b.js and c.js should depend on common.js\r\n  // they already does, so nothing happens\r\n  {\r\n    output: 'lib/common.js',\r\n    filter: ['lib/b.js', 'lib/c.js']\r\n  }\r\n]\r\n```"}}