{"action":"created","issue":{"url":"https://api.github.com/repos/rollup/rollup/issues/977","repository_url":"https://api.github.com/repos/rollup/rollup","labels_url":"https://api.github.com/repos/rollup/rollup/issues/977/labels{/name}","comments_url":"https://api.github.com/repos/rollup/rollup/issues/977/comments","events_url":"https://api.github.com/repos/rollup/rollup/issues/977/events","html_url":"https://github.com/rollup/rollup/issues/977","id":178972885,"number":977,"title":"Unused code included in output.","user":{"login":"mbostock","id":230541,"avatar_url":"https://avatars.githubusercontent.com/u/230541?v=3","gravatar_id":"","url":"https://api.github.com/users/mbostock","html_url":"https://github.com/mbostock","followers_url":"https://api.github.com/users/mbostock/followers","following_url":"https://api.github.com/users/mbostock/following{/other_user}","gists_url":"https://api.github.com/users/mbostock/gists{/gist_id}","starred_url":"https://api.github.com/users/mbostock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbostock/subscriptions","organizations_url":"https://api.github.com/users/mbostock/orgs","repos_url":"https://api.github.com/users/mbostock/repos","events_url":"https://api.github.com/users/mbostock/events{/privacy}","received_events_url":"https://api.github.com/users/mbostock/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rollup/rollup/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-09-23T21:02:48Z","updated_at":"2016-09-26T08:46:55Z","closed_at":null,"body":"Extracted from @bclinkinbeard’s [comment on #970](https://github.com/rollup/rollup/issues/970#issuecomment-249299835). Here’s a [minimal test case](http://rollupjs.org/?version=0.36.0&shareable=JTdCJTIyb3B0aW9ucyUyMiUzQSU3QiUyMmZvcm1hdCUyMiUzQSUyMmNqcyUyMiUyQyUyMm1vZHVsZU5hbWUlMjIlM0ElMjJteUJ1bmRsZSUyMiUyQyUyMmdsb2JhbHMlMjIlM0ElN0IlN0QlN0QlMkMlMjJtb2R1bGVzJTIyJTNBJTVCJTdCJTIybmFtZSUyMiUzQSUyMm1haW4uanMlMjIlMkMlMjJjb2RlJTIyJTNBJTIyaW1wb3J0JTIwZm9vJTIwZnJvbSUyMCU1QyUyMi4lMkZmb28lNUMlMjIlM0IlNUNuJTVDbmNvbnNvbGUubG9nKGZvbygpKSUzQiUyMCUyRiUyRiUyMGZvbyUyMiU3RCUyQyU3QiUyMm5hbWUlMjIlM0ElMjJmb28uanMlMjIlMkMlMjJjb2RlJTIyJTNBJTIyaW1wb3J0JTIwZGVhZCUyMGZyb20lMjAlNUMlMjIuJTJGZGVhZCU1QyUyMiUzQiU1Q24lNUNuZXhwb3J0JTIwZGVmYXVsdCUyMGZ1bmN0aW9uKCklMjAlN0IlMjByZXR1cm4lMjAlNUMlMjJmb28lNUMlMjIlM0IlMjAlN0QlNUNuZXhwb3J0JTIwZnVuY3Rpb24lMjBmb29kZWFkKCklMjAlN0IlMjByZXR1cm4lMjBkZWFkKCklM0IlMjAlN0QlMjIlN0QlMkMlN0IlMjJuYW1lJTIyJTNBJTIyZGVhZC5qcyUyMiUyQyUyMmNvZGUlMjIlM0ElMjJleHBvcnQlMjBkZWZhdWx0JTIwZnVuY3Rpb24oKSUyMCU3QiUyMHJldHVybiUyMCU1QyUyMmRlYWQlNUMlMjIlM0IlMjAlN0QlMjIlN0QlNUQlN0Q=).\r\n\r\nmain.js:\r\n\r\n```js\r\nimport foo from \"./foo\";\r\n\r\nconsole.log(foo()); // foo\r\n```\r\n\r\nfoo.js:\r\n\r\n```js\r\nimport dead from \"./dead\";\r\n\r\nexport default function() { return \"foo\"; }\r\nexport function foodead() { return dead(); }\r\n```\r\n\r\ndead.js:\r\n\r\n```js\r\nexport default function() { return \"dead\"; }\r\n```\r\n\r\nThe **expected output** is:\r\n\r\n```js\r\n'use strict';\r\n\r\nvar foo = function() { return \"foo\"; }\r\n\r\nconsole.log(foo()); // foo\r\n```\r\n\r\nThe **actual output** is:\r\n\r\n```js\r\n'use strict';\r\n\r\nvar dead = function() { return \"dead\"; }\r\n\r\nvar foo = function() { return \"foo\"; }\r\n\r\nconsole.log(foo()); // foo\r\n```\r\n\r\nSo, the invocation of `dead()` in foodead.js, even though the default export of dead.js is unused, is causing the definition of dead.js’s default export to be included in the output."},"comment":{"url":"https://api.github.com/repos/rollup/rollup/issues/comments/249513189","html_url":"https://github.com/rollup/rollup/issues/977#issuecomment-249513189","issue_url":"https://api.github.com/repos/rollup/rollup/issues/977","id":249513189,"user":{"login":"abe33","id":247140,"avatar_url":"https://avatars.githubusercontent.com/u/247140?v=3","gravatar_id":"","url":"https://api.github.com/users/abe33","html_url":"https://github.com/abe33","followers_url":"https://api.github.com/users/abe33/followers","following_url":"https://api.github.com/users/abe33/following{/other_user}","gists_url":"https://api.github.com/users/abe33/gists{/gist_id}","starred_url":"https://api.github.com/users/abe33/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abe33/subscriptions","organizations_url":"https://api.github.com/users/abe33/orgs","repos_url":"https://api.github.com/users/abe33/repos","events_url":"https://api.github.com/users/abe33/events{/privacy}","received_events_url":"https://api.github.com/users/abe33/received_events","type":"User","site_admin":false},"created_at":"2016-09-26T08:46:55Z","updated_at":"2016-09-26T08:46:55Z","body":"I'm not so sure it's related to default exports. I have tried using rollup in a test project and got the same issue of unused code preserved in the output (see the project [here](https://github.com/abe33/rollup-test)). In my case there's no default exports in any of the imported dependencies. The main file only import one function that is free of any other dependencies (https://github.com/abe33/rollup-test/blob/master/src/index.es6) and the output is filled with unused code (https://github.com/abe33/rollup-test/blob/master/lib/index.js).\r\n\r\nWhat's even weirder here, is that a class is included (https://github.com/abe33/rollup-test/blob/master/lib/index.js#L22-L34) while the code that requires it isn't (https://github.com/abe33/widjet-utils/blob/master/src/index.es6#L181-L216)"}}
{"actor":{"display_login":"abe33"}}