{"action":"created","issue":{"url":"https://api.github.com/repos/babel/babel/issues/2840","labels_url":"https://api.github.com/repos/babel/babel/issues/2840/labels{/name}","comments_url":"https://api.github.com/repos/babel/babel/issues/2840/comments","events_url":"https://api.github.com/repos/babel/babel/issues/2840/events","html_url":"https://github.com/babel/babel/pull/2840","id":115303743,"number":2840,"title":"core: add dirname option","user":{"login":"yorkie","id":1935767,"avatar_url":"https://avatars.githubusercontent.com/u/1935767?v=3","gravatar_id":"","url":"https://api.github.com/users/yorkie","html_url":"https://github.com/yorkie","followers_url":"https://api.github.com/users/yorkie/followers","following_url":"https://api.github.com/users/yorkie/following{/other_user}","gists_url":"https://api.github.com/users/yorkie/gists{/gist_id}","starred_url":"https://api.github.com/users/yorkie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yorkie/subscriptions","organizations_url":"https://api.github.com/users/yorkie/orgs","repos_url":"https://api.github.com/users/yorkie/repos","events_url":"https://api.github.com/users/yorkie/events{/privacy}","received_events_url":"https://api.github.com/users/yorkie/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-11-05T15:08:15Z","updated_at":"2015-11-24T08:59:59Z","closed_at":"2015-11-08T14:29:06Z","pull_request":{"url":"https://api.github.com/repos/babel/babel/pulls/2840","html_url":"https://github.com/babel/babel/pull/2840","diff_url":"https://github.com/babel/babel/pull/2840.diff","patch_url":"https://github.com/babel/babel/pull/2840.patch"},"body":"Hey babel team, I used babel and `gulp-babel`, that's fucking awesome let me program with ES2015. But when I gonna create a global Node.js module which uses `gulp-babel`, I get the following build error:\r\n\r\n```\r\ncannot find presets 'es2015'\r\n```\r\n\r\nAnd I'm quite sure that the `babel-presets` are installed under the global module's \"node_modules\", so after having research on source code of babel-core, just found the key is the following:\r\n\r\n```js\r\ndirname = dirname || process.cwd();\r\n```\r\n\r\nin `option-manager.js`. The `process.cwd()` seems to be wrong in my scenario, so I added `dirname` option for babel as my first bleed to this project. Thank you :-)\r\n\r\n/cc @sebmck "},"comment":{"url":"https://api.github.com/repos/babel/babel/issues/comments/159200177","html_url":"https://github.com/babel/babel/pull/2840#issuecomment-159200177","issue_url":"https://api.github.com/repos/babel/babel/issues/2840","id":159200177,"user":{"login":"camsong","id":948896,"avatar_url":"https://avatars.githubusercontent.com/u/948896?v=3","gravatar_id":"","url":"https://api.github.com/users/camsong","html_url":"https://github.com/camsong","followers_url":"https://api.github.com/users/camsong/followers","following_url":"https://api.github.com/users/camsong/following{/other_user}","gists_url":"https://api.github.com/users/camsong/gists{/gist_id}","starred_url":"https://api.github.com/users/camsong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/camsong/subscriptions","organizations_url":"https://api.github.com/users/camsong/orgs","repos_url":"https://api.github.com/users/camsong/repos","events_url":"https://api.github.com/users/camsong/events{/privacy}","received_events_url":"https://api.github.com/users/camsong/received_events","type":"User","site_admin":false},"created_at":"2015-11-24T08:59:59Z","updated_at":"2015-11-24T08:59:59Z","body":"Hope you guys can reconsider about this, since I saw quite a lot people have scenario to use this.\r\n\r\nAs we discussed in Slack, `require` does not works either.\r\n```js\r\nplugins: [require('babel-plugin-transform-export-extensions')],\r\n``` \r\n\r\nthe error message is \r\n```js\r\nERROR in ../op-live/src/js/source/app.js\r\nModule build failed: TypeError: Cannot read property '__esModule' of null\r\n    at Function.normalisePlugin (/Users/cam/ali/deer/node_modules/babel-core/lib/transformation/file/options/option-manager.js:156:20)\r\n    at /Users/cam/ali/deer/node_modules/babel-core/lib/transformation/file/options/option-manager.js:197:30\r\n    at Array.map (native)\r\n    at Function.normalisePlugins (/Users/cam/ali/deer/node_modules/babel-core/lib/transformation/file/options/option-manager.js:173:20)\r\n    at OptionManager.mergeOptions (/Users/cam/ali/deer/node_modules/babel-core/lib/transformation/file/options/option-manager.js:271:36)\r\n    at OptionManager.init (/Users/cam/ali/deer/node_modules/babel-core/lib/transformation/file/options/option-manager.js:416:10)\r\n    at File.initOptions (/Users/cam/ali/deer/node_modules/babel-core/lib/transformation/file/index.js:190:75)\r\n    at new File (/Users/cam/ali/deer/node_modules/babel-core/lib/transformation/file/index.js:121:22)\r\n    at Pipeline.transform (/Users/cam/ali/deer/node_modules/babel-core/lib/transformation/pipeline.js:42:16)\r\n    at transpile (/Users/cam/ali/deer/node_modules/babel-loader/index.js:14:22)\r\n```\r\n\r\nAnd the `opts` in `OptionManager.prototype.init`:\r\n```js\r\n{ inputSourceMap: undefined,\r\n  sourceRoot: '/Users/cam/ali/deer',\r\n  filename: '/Users/cam/ali/op-live/src/js/visitor/app.js',\r\n  plugins: [ null ],\r\n  presets:\r\n   [ { plugins: [Object] },\r\n     { plugins: [Object] },\r\n     { presets: [Object], plugins: [Object] } ],\r\n```\r\n\r\n\r\n"}}