{"action":"created","issue":{"url":"https://api.github.com/repos/marko-js/marko/issues/850","repository_url":"https://api.github.com/repos/marko-js/marko","labels_url":"https://api.github.com/repos/marko-js/marko/issues/850/labels{/name}","comments_url":"https://api.github.com/repos/marko-js/marko/issues/850/comments","events_url":"https://api.github.com/repos/marko-js/marko/issues/850/events","html_url":"https://github.com/marko-js/marko/issues/850","id":258369399,"number":850,"title":"handle ES module components","user":{"login":"christopherjbaker","id":980338,"avatar_url":"https://avatars3.githubusercontent.com/u/980338?v=4","gravatar_id":"","url":"https://api.github.com/users/christopherjbaker","html_url":"https://github.com/christopherjbaker","followers_url":"https://api.github.com/users/christopherjbaker/followers","following_url":"https://api.github.com/users/christopherjbaker/following{/other_user}","gists_url":"https://api.github.com/users/christopherjbaker/gists{/gist_id}","starred_url":"https://api.github.com/users/christopherjbaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christopherjbaker/subscriptions","organizations_url":"https://api.github.com/users/christopherjbaker/orgs","repos_url":"https://api.github.com/users/christopherjbaker/repos","events_url":"https://api.github.com/users/christopherjbaker/events{/privacy}","received_events_url":"https://api.github.com/users/christopherjbaker/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-09-18T04:43:54Z","updated_at":"2017-09-19T18:13:27Z","closed_at":null,"author_association":"NONE","body":"## New Feature\r\n\r\n### Description\r\nAllow component.js files to be created via ES modules (`export default class {}`).\r\n\r\n### Context\r\nI prefer to use `import`/`export` with babel instead of `require`/`module.exports`\r\n\r\n### Possible Implementation\r\nThe imported object from an es export like `export default class {}` is `{ default: class {} }`. Just need to look for the \"default\" key if the main object doesn't fit the expected structure.\r\n\r\n### Is this something you're interested in working on?\r\nYes. I attempted to do this myself, though I could not find the correct place to add the logic.\r\n"},"comment":{"url":"https://api.github.com/repos/marko-js/marko/issues/comments/330625150","html_url":"https://github.com/marko-js/marko/issues/850#issuecomment-330625150","issue_url":"https://api.github.com/repos/marko-js/marko/issues/850","id":330625150,"user":{"login":"mlrawlings","id":1958812,"avatar_url":"https://avatars1.githubusercontent.com/u/1958812?v=4","gravatar_id":"","url":"https://api.github.com/users/mlrawlings","html_url":"https://github.com/mlrawlings","followers_url":"https://api.github.com/users/mlrawlings/followers","following_url":"https://api.github.com/users/mlrawlings/following{/other_user}","gists_url":"https://api.github.com/users/mlrawlings/gists{/gist_id}","starred_url":"https://api.github.com/users/mlrawlings/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlrawlings/subscriptions","organizations_url":"https://api.github.com/users/mlrawlings/orgs","repos_url":"https://api.github.com/users/mlrawlings/repos","events_url":"https://api.github.com/users/mlrawlings/events{/privacy}","received_events_url":"https://api.github.com/users/mlrawlings/received_events","type":"User","site_admin":false},"created_at":"2017-09-19T18:13:27Z","updated_at":"2017-09-19T18:13:27Z","author_association":"OWNER","body":"@christopherjbaker Thanks for bringing this up!  We definitely want to support this (especially since ES modules are now behind a flag in Node 8.5).\r\n\r\nThe question is what do we want this to look like.  \r\n\r\n- We could do what the latest node does: treat `component.mjs` as ESM and `component.js` as CJS.\r\n- We could do something similar to babel (and what we already do for `import` within templates): `component = component.default || component`.  This is more compatible with how most people have been using ESM (without `.mjs`) but also runs the risk of a CJS module exporting an object with a `default` property being interpreted as ESM.\r\n\r\nBabel actually adds an additional check for `__esModule` which is added to the exports of a module:\r\n```js\r\nexport let foo = 123;\r\nexport default 456;\r\n```\r\n```js\r\nexports.__esModule = true;\r\nvar foo = exports.foo = 123;\r\nexports.default = 456;\r\n```\r\nBut this is not a standard behavior.\r\n\r\n"}}
{"actor":{"display_login":"mlrawlings"}}