{"action":"created","issue":{"url":"https://api.github.com/repos/square/field-kit/issues/30","labels_url":"https://api.github.com/repos/square/field-kit/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/square/field-kit/issues/30/comments","events_url":"https://api.github.com/repos/square/field-kit/issues/30/events","html_url":"https://github.com/square/field-kit/pull/30","id":105794630,"number":30,"title":"Optimize the build.","user":{"login":"eventualbuddha","id":1938,"avatar_url":"https://avatars.githubusercontent.com/u/1938?v=3","gravatar_id":"","url":"https://api.github.com/users/eventualbuddha","html_url":"https://github.com/eventualbuddha","followers_url":"https://api.github.com/users/eventualbuddha/followers","following_url":"https://api.github.com/users/eventualbuddha/following{/other_user}","gists_url":"https://api.github.com/users/eventualbuddha/gists{/gist_id}","starred_url":"https://api.github.com/users/eventualbuddha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eventualbuddha/subscriptions","organizations_url":"https://api.github.com/users/eventualbuddha/orgs","repos_url":"https://api.github.com/users/eventualbuddha/repos","events_url":"https://api.github.com/users/eventualbuddha/events{/privacy}","received_events_url":"https://api.github.com/users/eventualbuddha/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-09-10T12:19:49Z","updated_at":"2015-09-10T22:11:29Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/square/field-kit/pulls/30","html_url":"https://github.com/square/field-kit/pull/30","diff_url":"https://github.com/square/field-kit/pull/30.diff","patch_url":"https://github.com/square/field-kit/pull/30.patch"},"body":"This makes a bunch of changes in order to get a smaller, more efficient build.\r\n\r\n- switch from browserify to rollup to get faster, smaller, and more performant builds\r\n- keep browserify for building the test suite for now since it doesn’t match the requirements for using rollup yet (i.e. single entry point, `jsnext:main`-using dependencies)\r\n- drop source maps for the ‘dist’ build — this is one of the tradeoffs here as rollup-babel doesn’t support source maps\r\n- use ES6 module exports at the package boundary so rollup can transform to UMD properly\r\n- replace src/dist.js with rollup’s built-in UMD support\r\n\r\n### Size notes\r\n\r\nI compared<sup>1</sup> the sizes of the `dist` files in the latest version of field-kit, 2.0.1, with those built using this branch. The gzipped build on this branch is 2539 bytes smaller than the 2.0.1 build, and 20483 bytes smaller unzipped.\r\n\r\n#### field-kit@2.0.1\r\n\r\n- `dist/field-kit.js`: 227742 bytes\r\n- `dist/field-kit.min.js`: 92360 bytes\r\n- `dist/field-kit.min.js.gz`: 18788 bytes\r\n\r\n#### This branch\r\n\r\n- `dist/field-kit.js`: 209858 bytes\r\n- `dist/field-kit.min.js`: 71877 bytes\r\n- `dist/field-kit.min.js.gz`: 16249 bytes\r\n\r\nI attribute the size difference to:\r\n- no `process` shim\r\n- no CommonJS boilerplate\r\n- dead code elimination inherent in rollup\r\n- no duplication of babel helpers (e.g. `_createClass` is defined 15 times in 2.0.1!)\r\n- no duplication of `\"use strict\"` directive\r\n\r\n---\r\n1. Here are the commands used to generate the file sizes:\r\n```\r\ncat dist/field-kit.js | wc -c\r\ncat dist/field-kit.min.js | wc -c\r\ncat dist/field-kit.min.js | gzip | wc -c\r\n```"},"comment":{"url":"https://api.github.com/repos/square/field-kit/issues/comments/139397124","html_url":"https://github.com/square/field-kit/pull/30#issuecomment-139397124","issue_url":"https://api.github.com/repos/square/field-kit/issues/30","id":139397124,"user":{"login":"Rich-Harris","id":1162160,"avatar_url":"https://avatars.githubusercontent.com/u/1162160?v=3","gravatar_id":"","url":"https://api.github.com/users/Rich-Harris","html_url":"https://github.com/Rich-Harris","followers_url":"https://api.github.com/users/Rich-Harris/followers","following_url":"https://api.github.com/users/Rich-Harris/following{/other_user}","gists_url":"https://api.github.com/users/Rich-Harris/gists{/gist_id}","starred_url":"https://api.github.com/users/Rich-Harris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Rich-Harris/subscriptions","organizations_url":"https://api.github.com/users/Rich-Harris/orgs","repos_url":"https://api.github.com/users/Rich-Harris/repos","events_url":"https://api.github.com/users/Rich-Harris/events{/privacy}","received_events_url":"https://api.github.com/users/Rich-Harris/received_events","type":"User","site_admin":false},"created_at":"2015-09-10T22:11:29Z","updated_at":"2015-09-10T22:11:29Z","body":"> rollup is not built to bundle things that don't have a single entry point, like tests\r\n\r\nCould you describe the problem in more detail? If I understand, then there two options spring to mind:\r\n\r\n1. Creating a file that `import`s what would otherwise be the multiple entry points\r\n2. Updating Rollup to allow multiple entry points :grinning: \r\n\r\nI initially shied away from 2 because it potentially introduces an ambiguity about what gets exported from the bundle, but if there's a strong enough use case then I don't think it would be especially difficult to add"}}