{"action":"opened","issue":{"url":"https://api.github.com/repos/pegjs/pegjs/issues/423","repository_url":"https://api.github.com/repos/pegjs/pegjs","labels_url":"https://api.github.com/repos/pegjs/pegjs/issues/423/labels{/name}","comments_url":"https://api.github.com/repos/pegjs/pegjs/issues/423/comments","events_url":"https://api.github.com/repos/pegjs/pegjs/issues/423/events","html_url":"https://github.com/pegjs/pegjs/issues/423","id":146675229,"number":423,"title":"Add support for ES6 modules","user":{"login":"fatfisz","id":6004414,"avatar_url":"https://avatars.githubusercontent.com/u/6004414?v=3","gravatar_id":"","url":"https://api.github.com/users/fatfisz","html_url":"https://github.com/fatfisz","followers_url":"https://api.github.com/users/fatfisz/followers","following_url":"https://api.github.com/users/fatfisz/following{/other_user}","gists_url":"https://api.github.com/users/fatfisz/gists{/gist_id}","starred_url":"https://api.github.com/users/fatfisz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fatfisz/subscriptions","organizations_url":"https://api.github.com/users/fatfisz/orgs","repos_url":"https://api.github.com/users/fatfisz/repos","events_url":"https://api.github.com/users/fatfisz/events{/privacy}","received_events_url":"https://api.github.com/users/fatfisz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-04-07T16:23:53Z","updated_at":"2016-04-07T16:23:53Z","closed_at":null,"body":"Currently the `buildParser` method returns either an object or an IIFE. This prevents seamless ES6-style imports.\r\n\r\nThere is a plugin that allows importing parsers built from grammar files, `rollup-plugin-pegjs`. It currently can't do much more than either `export default generatedParser;` or `module.exports = generatedParser;`.\r\n\r\nDespite the claims in the `rollup-plugin-pegjs` README that\r\n```js\r\nimport { parse } from \"grammar.pegjs\";\r\n```\r\nis possible, I've been unable to do so and have to rely on this:\r\n```js\r\nimport parser from \"grammar.pegjs\";\r\nconst { parse } = parser;\r\n```\r\n\r\nSo taking that into consideration, would it be ok if there was another option for `output`: `source-es6` or `source-es6-module` that would have IIFE stripped and would have ES6-style exports instead of returning an object?\r\n\r\nI could do the PR if the idea is accepted."}}