{"action":"created","issue":{"url":"https://api.github.com/repos/rollup/rollup/issues/144","labels_url":"https://api.github.com/repos/rollup/rollup/issues/144/labels{/name}","comments_url":"https://api.github.com/repos/rollup/rollup/issues/144/comments","events_url":"https://api.github.com/repos/rollup/rollup/issues/144/events","html_url":"https://github.com/rollup/rollup/issues/144","id":108273515,"number":144,"title":"Loose mode for import * as","user":{"login":"lukeapage","id":309321,"avatar_url":"https://avatars.githubusercontent.com/u/309321?v=3","gravatar_id":"","url":"https://api.github.com/users/lukeapage","html_url":"https://github.com/lukeapage","followers_url":"https://api.github.com/users/lukeapage/followers","following_url":"https://api.github.com/users/lukeapage/following{/other_user}","gists_url":"https://api.github.com/users/lukeapage/gists{/gist_id}","starred_url":"https://api.github.com/users/lukeapage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukeapage/subscriptions","organizations_url":"https://api.github.com/users/lukeapage/orgs","repos_url":"https://api.github.com/users/lukeapage/repos","events_url":"https://api.github.com/users/lukeapage/events{/privacy}","received_events_url":"https://api.github.com/users/lukeapage/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rollup/rollup/labels/discussion","name":"discussion","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-25T06:48:27Z","updated_at":"2015-09-25T07:34:23Z","closed_at":null,"body":"Hi,\r\n\r\nWhen using `import * as` we get the following output\r\n\r\n```\r\nvar a = {\r\n    get foo() { return foo; }\r\n}\r\n```\r\n\r\nwhich is \"correct\", however a shorter form would be\r\n```\r\nvar a = { foo: foo };\r\n```\r\n\r\nWould you consider a option that didn't bother with writing getters.. since I very much doubt any code will depend on not being able to set things on that object?"},"comment":{"url":"https://api.github.com/repos/rollup/rollup/issues/comments/143149556","html_url":"https://github.com/rollup/rollup/issues/144#issuecomment-143149556","issue_url":"https://api.github.com/repos/rollup/rollup/issues/144","id":143149556,"user":{"login":"Victorystick","id":703602,"avatar_url":"https://avatars.githubusercontent.com/u/703602?v=3","gravatar_id":"","url":"https://api.github.com/users/Victorystick","html_url":"https://github.com/Victorystick","followers_url":"https://api.github.com/users/Victorystick/followers","following_url":"https://api.github.com/users/Victorystick/following{/other_user}","gists_url":"https://api.github.com/users/Victorystick/gists{/gist_id}","starred_url":"https://api.github.com/users/Victorystick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Victorystick/subscriptions","organizations_url":"https://api.github.com/users/Victorystick/orgs","repos_url":"https://api.github.com/users/Victorystick/repos","events_url":"https://api.github.com/users/Victorystick/events{/privacy}","received_events_url":"https://api.github.com/users/Victorystick/received_events","type":"User","site_admin":false},"created_at":"2015-09-25T07:34:23Z","updated_at":"2015-09-25T07:34:23Z","body":"@Rich-Harris has [considered avoiding getters](https://github.com/rollup/rollup/blob/master/src/Bundle.js#L236-L243), at least for `exports` and ES3 environments. I don't think that it'd be possible in general, as it breaks with the ECMAScript spec for exports that get reassigned.\r\n\r\nHowever, it would be possible to optimise `const` exports. For instance,\r\n```js\r\nexport const foo = {};\r\n````\r\nwhen imported as `import * as a` _could_ generate\r\n```js\r\nvar a = { foo: foo };\r\nObject.defineProperty(a, 'foo', {\r\n  enumerable: true,\r\n  value: foo\r\n});\r\n```\r\nsince we know that `foo` isn't going to be reassigned. It isn't shorter exactly, but wouldn't include the overhead of a getter function."}}