{"action":"created","issue":{"url":"https://api.github.com/repos/webpack/webpack/issues/4135","repository_url":"https://api.github.com/repos/webpack/webpack","labels_url":"https://api.github.com/repos/webpack/webpack/issues/4135/labels{/name}","comments_url":"https://api.github.com/repos/webpack/webpack/issues/4135/comments","events_url":"https://api.github.com/repos/webpack/webpack/issues/4135/events","html_url":"https://github.com/webpack/webpack/issues/4135","id":203910230,"number":4135,"title":"New CommonsChunk vendor algorithm/functionality","user":{"login":"elfey","id":24572473,"avatar_url":"https://avatars.githubusercontent.com/u/24572473?v=3","gravatar_id":"","url":"https://api.github.com/users/elfey","html_url":"https://github.com/elfey","followers_url":"https://api.github.com/users/elfey/followers","following_url":"https://api.github.com/users/elfey/following{/other_user}","gists_url":"https://api.github.com/users/elfey/gists{/gist_id}","starred_url":"https://api.github.com/users/elfey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elfey/subscriptions","organizations_url":"https://api.github.com/users/elfey/orgs","repos_url":"https://api.github.com/users/elfey/repos","events_url":"https://api.github.com/users/elfey/events{/privacy}","received_events_url":"https://api.github.com/users/elfey/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-01-30T00:53:34Z","updated_at":"2017-02-16T10:50:26Z","closed_at":"2017-01-30T03:36:04Z","body":"<!-- Please don't delete this template or we'll close your issue -->\r\n<!-- Before creating an issue please make sure you are using the latest version of webpack. -->\r\n<!-- Also consider trying the webpack@beta version, maybe it's already fixed. -->\r\n\r\n**Do you want to request a *feature* or report a *bug*?**\r\nFeature.\r\n\r\n<!-- Please ask questions on StackOverflow or the webpack Gitter (https://gitter.im/webpack/webpack). -->\r\n<!-- Issues which contain questions or support requests will be closed. -->\r\n\r\n**What is the current behavior?**\r\nCurrently CommonsChunk is great for applications that explicitly define chunks, but for applications that don't, there's an issue... we have to explicitly declare all of our vendors, which change, and every time a dependency is removed/added, we have to update that list of vendors.\r\n\r\nThere's also the added issue that when we define that list of vendors we'd like to include in our `vendor.js`, we're typically going to request that the entire dependency and functionality of that dependency is included so that we don't get errors or lose functionality. That means that for certain dependencies, we end up including the entire dependency, even if we're only using one function from it.\r\n\r\nI'd like to propose that CommonsChunk plugin scans the list of dependencies for each file, and it counts `import` statements for each dependency. If the count for a particular dependency is greater than the `minDependency` (or we could call it `minImport`) value, it's safe to assume that because of how common that dependency is within the application (and how often it's being `import`ed) that it's an essential part of the application's vendors and isn't going away any time soon.\r\n\r\nSo we automatically take that dependency and bundle it into the `vendor.js` file.\r\n\r\nThis means that we get `vendor.js`, and its beautiful caching properties, without the pain of continuously having to modify our config file.\r\n\r\n**If this is a feature request, what is motivation or use case for changing the behavior?**\r\nIt's a total pain to constantly be updating vendors.\r\n"},"comment":{"url":"https://api.github.com/repos/webpack/webpack/issues/comments/280298296","html_url":"https://github.com/webpack/webpack/issues/4135#issuecomment-280298296","issue_url":"https://api.github.com/repos/webpack/webpack/issues/4135","id":280298296,"user":{"login":"dmitriid","id":32768,"avatar_url":"https://avatars.githubusercontent.com/u/32768?v=3","gravatar_id":"","url":"https://api.github.com/users/dmitriid","html_url":"https://github.com/dmitriid","followers_url":"https://api.github.com/users/dmitriid/followers","following_url":"https://api.github.com/users/dmitriid/following{/other_user}","gists_url":"https://api.github.com/users/dmitriid/gists{/gist_id}","starred_url":"https://api.github.com/users/dmitriid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmitriid/subscriptions","organizations_url":"https://api.github.com/users/dmitriid/orgs","repos_url":"https://api.github.com/users/dmitriid/repos","events_url":"https://api.github.com/users/dmitriid/events{/privacy}","received_events_url":"https://api.github.com/users/dmitriid/received_events","type":"User","site_admin":false},"created_at":"2017-02-16T10:50:26Z","updated_at":"2017-02-16T10:50:26Z","body":"This still requires you to list all modules from `node_modules` in the `entry` object though, don't you? As in\r\n\r\n```\r\n  entry:   {\r\n    app: './app.js',\r\n    lib: [\r\n      \"axios\",\r\n      \"es6-promise\",\r\n      \"fast.js\",\r\n      \"google-map-react\",\r\n      \"jed\",\r\n      \"jquery\",\r\n      \"mobx\",\r\n      \"mobx-react\",\r\n      \"mobx-react-devtools\",\r\n      \"moment\",\r\n      \"moment-timezone\",\r\n      \"pikaday\",\r\n      \"po2json\",\r\n      \"react\",\r\n      \"react-dom\",\r\n      \"router5\"\r\n    ]\r\n  },\r\n  output:  {\r\n    path:          './build/app.js',\r\n    publicPath:    '/events/build/js',\r\n    filename:      \"[name].js\",\r\n    chunkFilename: \".js\"\r\n  },\r\n```\r\n\r\netc.?"}}
{"actor":{"display_login":"dmitriid"}}