{"action":"created","issue":{"url":"https://api.github.com/repos/riot/compiler/issues/15","labels_url":"https://api.github.com/repos/riot/compiler/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/riot/compiler/issues/15/comments","events_url":"https://api.github.com/repos/riot/compiler/issues/15/events","html_url":"https://github.com/riot/compiler/issues/15","id":115122093,"number":15,"title":"babel compiler destroys this references within a tag","user":{"login":"appedemic","id":3819227,"avatar_url":"https://avatars.githubusercontent.com/u/3819227?v=3","gravatar_id":"","url":"https://api.github.com/users/appedemic","html_url":"https://github.com/appedemic","followers_url":"https://api.github.com/users/appedemic/followers","following_url":"https://api.github.com/users/appedemic/following{/other_user}","gists_url":"https://api.github.com/users/appedemic/gists{/gist_id}","starred_url":"https://api.github.com/users/appedemic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appedemic/subscriptions","organizations_url":"https://api.github.com/users/appedemic/orgs","repos_url":"https://api.github.com/users/appedemic/repos","events_url":"https://api.github.com/users/appedemic/events{/privacy}","received_events_url":"https://api.github.com/users/appedemic/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-11-04T18:50:49Z","updated_at":"2015-11-04T19:59:35Z","closed_at":null,"body":"Consider this tag file (test.tag):\r\n```html\r\n<test>\r\n  <script>\r\n    this.x = 1;\r\n  </script>\r\n</test>\r\n```\r\nI am compiling stuff using gulp, browserify, babelify and riotify to a single bundle, using babel-core > 6.0.2. I am using the \"type: babel\" compiler. When looking at the output, the tag is compiled to:\r\n\r\n```js\r\nmodule.exports = riot.tag2('test', '', '', '', function(opts) {\r\nundefined.x = 1;\r\n});\r\n```\r\nSomehow all references to _this_ are replaced by _undefined_. It has to do something with the _es2015_ preset used. When I change the preset in the compiler from _es2015_ to _stage-0_, the correct output is generated:\r\n\r\n```js\r\nmodule.exports = riot.tag2('test', '', '', '', function(opts) {\r\nthis.x = 1;\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/riot/compiler/issues/comments/153846438","html_url":"https://github.com/riot/compiler/issues/15#issuecomment-153846438","issue_url":"https://api.github.com/repos/riot/compiler/issues/15","id":153846438,"user":{"login":"appedemic","id":3819227,"avatar_url":"https://avatars.githubusercontent.com/u/3819227?v=3","gravatar_id":"","url":"https://api.github.com/users/appedemic","html_url":"https://github.com/appedemic","followers_url":"https://api.github.com/users/appedemic/followers","following_url":"https://api.github.com/users/appedemic/following{/other_user}","gists_url":"https://api.github.com/users/appedemic/gists{/gist_id}","starred_url":"https://api.github.com/users/appedemic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appedemic/subscriptions","organizations_url":"https://api.github.com/users/appedemic/orgs","repos_url":"https://api.github.com/users/appedemic/repos","events_url":"https://api.github.com/users/appedemic/events{/privacy}","received_events_url":"https://api.github.com/users/appedemic/received_events","type":"User","site_admin":false},"created_at":"2015-11-04T19:59:35Z","updated_at":"2015-11-04T19:59:35Z","body":"One fix would be to omit the transform-es2015-modules-commonjs plugin from the list, but this means that the preset es2015 cannot be used and instead you need to make a list of plugins, including all the plugins from the es2015 preset, except the modules-commonjs one."}}