{"action":"created","issue":{"url":"https://api.github.com/repos/jashkenas/coffeescript/issues/3162","labels_url":"https://api.github.com/repos/jashkenas/coffeescript/issues/3162/labels{/name}","comments_url":"https://api.github.com/repos/jashkenas/coffeescript/issues/3162/comments","events_url":"https://api.github.com/repos/jashkenas/coffeescript/issues/3162/events","html_url":"https://github.com/jashkenas/coffeescript/issues/3162","id":19300974,"number":3162,"title":"Add support for ES6 module syntax","user":{"login":"aexmachina","id":261804,"avatar_url":"https://avatars.githubusercontent.com/u/261804?v=3","gravatar_id":"","url":"https://api.github.com/users/aexmachina","html_url":"https://github.com/aexmachina","followers_url":"https://api.github.com/users/aexmachina/followers","following_url":"https://api.github.com/users/aexmachina/following{/other_user}","gists_url":"https://api.github.com/users/aexmachina/gists{/gist_id}","starred_url":"https://api.github.com/users/aexmachina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aexmachina/subscriptions","organizations_url":"https://api.github.com/users/aexmachina/orgs","repos_url":"https://api.github.com/users/aexmachina/repos","events_url":"https://api.github.com/users/aexmachina/events{/privacy}","received_events_url":"https://api.github.com/users/aexmachina/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jashkenas/coffeescript/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/jashkenas/coffeescript/labels/wontfix","name":"wontfix","color":"ffffff"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":79,"created_at":"2013-09-11T05:59:26Z","updated_at":"2015-10-06T23:27:51Z","closed_at":"2013-09-11T11:59:27Z","body":"Maybe I'm missing something, but I can't see how to use ES6 modules from CoffeeScript. We should have this."},"comment":{"url":"https://api.github.com/repos/jashkenas/coffeescript/issues/comments/146032899","html_url":"https://github.com/jashkenas/coffeescript/issues/3162#issuecomment-146032899","issue_url":"https://api.github.com/repos/jashkenas/coffeescript/issues/3162","id":146032899,"user":{"login":"markbrown4","id":140878,"avatar_url":"https://avatars.githubusercontent.com/u/140878?v=3","gravatar_id":"","url":"https://api.github.com/users/markbrown4","html_url":"https://github.com/markbrown4","followers_url":"https://api.github.com/users/markbrown4/followers","following_url":"https://api.github.com/users/markbrown4/following{/other_user}","gists_url":"https://api.github.com/users/markbrown4/gists{/gist_id}","starred_url":"https://api.github.com/users/markbrown4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markbrown4/subscriptions","organizations_url":"https://api.github.com/users/markbrown4/orgs","repos_url":"https://api.github.com/users/markbrown4/repos","events_url":"https://api.github.com/users/markbrown4/events{/privacy}","received_events_url":"https://api.github.com/users/markbrown4/received_events","type":"User","site_admin":false},"created_at":"2015-10-06T23:27:51Z","updated_at":"2015-10-06T23:27:51Z","body":"It might be time to revisit this, a proper module system is one of the strongest reasons people are adopting Babel / abandoning coffeescript.\r\n\r\nRather than leaving export/import statements in the compiled source and leaving the job to another project like Webpack isn't it possible to wrap an modules using an import statement and delaying them until the dependencies are met to make them load order independent?\r\n\r\nHere's a naive version of what I'm describing:\r\n\r\n*lib.coffee*\r\n```coffee\r\nexport square(x)-> x * x\r\n```\r\n*script.coffee*\r\n```coffee\r\nimport { square } from 'lib'\r\nalert square(2)\r\n```\r\n*lib.js*\r\n```js\r\n// head\r\nvar _modules, _scripts;\r\n_modules = {};\r\n_scripts = [];\r\n\r\n(function() {\r\n\r\n  _modules['lib'] = {}\r\n  _modules['lib'].square = function(x) {\r\n    return x * x;\r\n  }\r\n\r\n})();\r\n```\r\n*script.js*\r\n```js\r\n_scripts.push(function() {\r\n  var square;\r\n  square = _modules['lib'].square;\r\n  \r\n  alert(square(2));\r\n})\r\n\r\n// tail\r\nvar i, len;\r\nfor (var i = 0, len = _scripts.length; i < len; i++) {\r\n  _scripts[i]();\r\n}\r\n```\r\n\r\nThis may be naive but it doesn't seem like an impossible task to get the expected behavior of modules inside of coffeescript."}}