{"action":"created","issue":{"url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/614","repository_url":"https://api.github.com/repos/gatsbyjs/gatsby","labels_url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/614/labels{/name}","comments_url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/614/comments","events_url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/614/events","html_url":"https://github.com/gatsbyjs/gatsby/issues/614","id":196988148,"number":614,"title":"bundle.js size","user":{"login":"g8tguy","id":22907656,"avatar_url":"https://avatars.githubusercontent.com/u/22907656?v=3","gravatar_id":"","url":"https://api.github.com/users/g8tguy","html_url":"https://github.com/g8tguy","followers_url":"https://api.github.com/users/g8tguy/followers","following_url":"https://api.github.com/users/g8tguy/following{/other_user}","gists_url":"https://api.github.com/users/g8tguy/gists{/gist_id}","starred_url":"https://api.github.com/users/g8tguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/g8tguy/subscriptions","organizations_url":"https://api.github.com/users/g8tguy/orgs","repos_url":"https://api.github.com/users/g8tguy/repos","events_url":"https://api.github.com/users/g8tguy/events{/privacy}","received_events_url":"https://api.github.com/users/g8tguy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-21T17:23:38Z","updated_at":"2016-12-21T17:44:06Z","closed_at":null,"body":"I included simple lodash function in my code\r\n\r\n```\r\n       var users = [\r\n            { 'user': 'fred',   'age': 48 },\r\n            { 'user': 'barney', 'age': 36 },\r\n            { 'user': 'fred',   'age': 40 },\r\n            { 'user': 'barney', 'age': 34 }\r\n        ];\r\n        sortBy(users, [function(o) { return o.user; }])\r\n```\r\nand the bundle size grew by 70kb - isn't that too mach for just a `sortBy`?\r\n```\r\nmoment(\"2015-12-15T15:30\").format(\"Do MMMM YYYY\")\r\n```\r\nand then I added momentjs  it's +40kb also.\r\n\r\nshouldn't webpack to include only the necessary code? "},"comment":{"url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/comments/268590112","html_url":"https://github.com/gatsbyjs/gatsby/issues/614#issuecomment-268590112","issue_url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/614","id":268590112,"user":{"login":"jquense","id":339286,"avatar_url":"https://avatars.githubusercontent.com/u/339286?v=3","gravatar_id":"","url":"https://api.github.com/users/jquense","html_url":"https://github.com/jquense","followers_url":"https://api.github.com/users/jquense/followers","following_url":"https://api.github.com/users/jquense/following{/other_user}","gists_url":"https://api.github.com/users/jquense/gists{/gist_id}","starred_url":"https://api.github.com/users/jquense/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jquense/subscriptions","organizations_url":"https://api.github.com/users/jquense/orgs","repos_url":"https://api.github.com/users/jquense/repos","events_url":"https://api.github.com/users/jquense/events{/privacy}","received_events_url":"https://api.github.com/users/jquense/received_events","type":"User","site_admin":false},"created_at":"2016-12-21T17:44:06Z","updated_at":"2016-12-21T17:44:06Z","body":"webpack includes what _modules_ you tell it too. So `import { sortBy } from 'lodash'` is going to include all of lodash, because you imported all of lodash. webpack2 has a feature called tree shaking that can **somewhat** optimize that import by understanding the es module syntax. **however** its an optimization that is really susceptible to failure, because how dynamic JavaScript is as a language, its not always possible to know what code is needed, even if you know the imports. In confusing cases, the compiler has to bail out and just include everything. "}}
{"actor":{"display_login":"jquense"}}