{"action":"created","issue":{"url":"https://api.github.com/repos/d3/d3/issues/2985","repository_url":"https://api.github.com/repos/d3/d3","labels_url":"https://api.github.com/repos/d3/d3/issues/2985/labels{/name}","comments_url":"https://api.github.com/repos/d3/d3/issues/2985/comments","events_url":"https://api.github.com/repos/d3/d3/issues/2985/events","html_url":"https://github.com/d3/d3/issues/2985","id":179647950,"number":2985,"title":"D3 3 broken with babel application","user":{"login":"fheidrich","id":828080,"avatar_url":"https://avatars.githubusercontent.com/u/828080?v=3","gravatar_id":"","url":"https://api.github.com/users/fheidrich","html_url":"https://github.com/fheidrich","followers_url":"https://api.github.com/users/fheidrich/followers","following_url":"https://api.github.com/users/fheidrich/following{/other_user}","gists_url":"https://api.github.com/users/fheidrich/gists{/gist_id}","starred_url":"https://api.github.com/users/fheidrich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fheidrich/subscriptions","organizations_url":"https://api.github.com/users/fheidrich/orgs","repos_url":"https://api.github.com/users/fheidrich/repos","events_url":"https://api.github.com/users/fheidrich/events{/privacy}","received_events_url":"https://api.github.com/users/fheidrich/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-09-28T00:04:57Z","updated_at":"2016-09-28T17:36:12Z","closed_at":"2016-09-28T17:36:12Z","body":"Hello\r\nI have a requireJS+babel application which uses \"transform-es2015-modules-amd\" plugin.\r\nRecently I updated to d3.4.2.4 and now my transpiled code no longer works with d3.\r\n\r\nThe reason seems to be the following line at the end of  https://d3js.org/d3.v4.js\r\nObject.defineProperty(exports, '__esModule', { value: true });\r\n\r\nFor me, during runtime everything is amd modules, and transform-es2015-modules-amd uses the same __esModule to mark the modules it has transpiled, modules without the __esModule=true are handle a bit differently.\r\n\r\nAnyhow, d3.js apparently was build by a different build system (rollup, webpack, I don't know) which also sets __esModule=true but does not play along with babel.\r\n\r\nI think d3 could be changed to work with babel, the first lines in d3.js it selects the module system:\r\n(a)  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\r\n(b) typeof define === 'function' && define.amd ? define(['exports'], factory) :\r\n(c)  (factory((global.d3 = global.d3 || {})));\r\n\r\nI think the \"Object.defineProperty(exports, '__esModule', { value: true });\" is only needed for the (a) case. The (b) case is AMD runtime, which is my case, if __esModule is not set then my code should just work. The (c) is putting d3 in the global name space, certainly that doesn't need __esModule.\r\n\r\nIn short, at the end of d3.js I wish we could have:\r\nif (typeof exports === 'object' && typeof module !== 'undefined') {\r\nObject.defineProperty(exports, '__esModule', { value: true });\r\n}\r\n\r\nThank you\r\nFelipe"},"comment":{"url":"https://api.github.com/repos/d3/d3/issues/comments/250239970","html_url":"https://github.com/d3/d3/issues/2985#issuecomment-250239970","issue_url":"https://api.github.com/repos/d3/d3/issues/2985","id":250239970,"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},"created_at":"2016-09-28T17:36:11Z","updated_at":"2016-09-28T17:36:11Z","body":"This behavior is entirely controlled by Rollup. If you’d like to change Rollup’s output for its UMD format, please file an issue over on [rollup/rollup](https://github.com/rollup/rollup/issues)."}}
{"actor":{"display_login":"mbostock"}}