{"action":"created","issue":{"url":"https://api.github.com/repos/babel/babelify/issues/81","labels_url":"https://api.github.com/repos/babel/babelify/issues/81/labels{/name}","comments_url":"https://api.github.com/repos/babel/babelify/issues/81/comments","events_url":"https://api.github.com/repos/babel/babelify/issues/81/events","html_url":"https://github.com/babel/babelify/issues/81","id":74778162,"number":81,"title":"Working with transforms: brfs, glslify, etc","user":{"login":"mattdesl","id":1383811,"avatar_url":"https://avatars.githubusercontent.com/u/1383811?v=3","gravatar_id":"","url":"https://api.github.com/users/mattdesl","html_url":"https://github.com/mattdesl","followers_url":"https://api.github.com/users/mattdesl/followers","following_url":"https://api.github.com/users/mattdesl/following{/other_user}","gists_url":"https://api.github.com/users/mattdesl/gists{/gist_id}","starred_url":"https://api.github.com/users/mattdesl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattdesl/subscriptions","organizations_url":"https://api.github.com/users/mattdesl/orgs","repos_url":"https://api.github.com/users/mattdesl/repos","events_url":"https://api.github.com/users/mattdesl/events{/privacy}","received_events_url":"https://api.github.com/users/mattdesl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-05-09T23:02:41Z","updated_at":"2015-05-28T15:54:05Z","closed_at":null,"body":"Because of the way babel transforms some of the require statements, it ends up breaking things like brfs, glslify, and other source transforms that need to statically analyze the functions. \r\n\r\nFor example:\r\n\r\n```js\r\nimport fs from 'fs'\r\nconsole.log(fs.readFileSync(__dirname+'/README.md', 'utf8'))\r\n```\r\n\r\nGets transformed into:\r\n\r\n```js\r\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\r\nvar _fs = require('fs');\r\nvar _fs2 = _interopRequireDefault(_fs);\r\nconsole.log(_fs2['default'].readFileSync(__dirname + '/README.md', 'utf8'));\r\n```\r\n\r\nAny ideas?"},"comment":{"url":"https://api.github.com/repos/babel/babelify/issues/comments/106438542","html_url":"https://github.com/babel/babelify/issues/81#issuecomment-106438542","issue_url":"https://api.github.com/repos/babel/babelify/issues/81","id":106438542,"user":{"login":"mattdesl","id":1383811,"avatar_url":"https://avatars.githubusercontent.com/u/1383811?v=3","gravatar_id":"","url":"https://api.github.com/users/mattdesl","html_url":"https://github.com/mattdesl","followers_url":"https://api.github.com/users/mattdesl/followers","following_url":"https://api.github.com/users/mattdesl/following{/other_user}","gists_url":"https://api.github.com/users/mattdesl/gists{/gist_id}","starred_url":"https://api.github.com/users/mattdesl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattdesl/subscriptions","organizations_url":"https://api.github.com/users/mattdesl/orgs","repos_url":"https://api.github.com/users/mattdesl/repos","events_url":"https://api.github.com/users/mattdesl/events{/privacy}","received_events_url":"https://api.github.com/users/mattdesl/received_events","type":"User","site_admin":false},"created_at":"2015-05-28T15:54:05Z","updated_at":"2015-05-28T15:54:05Z","body":"It will eventually be possible once static-module can handle ES6 imports. For now you need to 'require' brfs with CommonJS syntax, and run the brfs transform after babelify. \n\nIf you have non standard ES6, like JSX or experimental babel features, it won't work having brfs transform before babelify. \n\nSent from my iPhone\n\n> On May 28, 2015, at 11:27 AM, Julien Bouquillon <notifications@github.com> wrote:\n> \n> so no way to use brfs+babelify ?\n> \n> —\n> Reply to this email directly or view it on GitHub.\n> \n"}}