{"action":"created","issue":{"url":"https://api.github.com/repos/gulpjs/gulp/issues/1234","repository_url":"https://api.github.com/repos/gulpjs/gulp","labels_url":"https://api.github.com/repos/gulpjs/gulp/issues/1234/labels{/name}","comments_url":"https://api.github.com/repos/gulpjs/gulp/issues/1234/comments","events_url":"https://api.github.com/repos/gulpjs/gulp/issues/1234/events","html_url":"https://github.com/gulpjs/gulp/issues/1234","id":105138350,"number":1234,"title":"gulpfile.babel.js does not compile imported es6 modules from node_modules","user":{"login":"shadowmint","id":355760,"avatar_url":"https://avatars.githubusercontent.com/u/355760?v=3","gravatar_id":"","url":"https://api.github.com/users/shadowmint","html_url":"https://github.com/shadowmint","followers_url":"https://api.github.com/users/shadowmint/followers","following_url":"https://api.github.com/users/shadowmint/following{/other_user}","gists_url":"https://api.github.com/users/shadowmint/gists{/gist_id}","starred_url":"https://api.github.com/users/shadowmint/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shadowmint/subscriptions","organizations_url":"https://api.github.com/users/shadowmint/orgs","repos_url":"https://api.github.com/users/shadowmint/repos","events_url":"https://api.github.com/users/shadowmint/events{/privacy}","received_events_url":"https://api.github.com/users/shadowmint/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-09-07T03:23:11Z","updated_at":"2016-03-21T18:42:20Z","closed_at":"2015-09-07T03:59:25Z","body":"tldr; When running in 'babel' mode, gulp compiles local files from es6 to js to run them.\r\nHowever, modules in node_modules are assumed to already be compiled and are not modified.\r\n\r\nWhat's up with that?\r\n\r\n### long version\r\n\r\nRepo showing the issue: https://github.com/shadowmint/tmp-gulp-test-babel\r\n\r\nThe error:\r\n\r\n```\r\ndoug:gulptmp doug$ gulp\r\n[11:17:18] Requiring external module babel-core/register\r\n/Users/doug/gulptmp/node_modules/foo/index.js:1\r\n(function (exports, require, module, __filename, __dirname) { export default f\r\n                                                              ^^^^^^\r\nSyntaxError: Unexpected reserved word\r\n    at exports.runInThisContext (vm.js:73:16)\r\n    at Module._compile (module.js:443:25)\r\n    at Module._extensions..js (module.js:478:10)\r\n    at Object.require.extensions.(anonymous function) [as .js] (/Users/doug/gulptmp/node_modules/babel-core/lib/api/register/node.js:214:7)\r\n    at Module.load (module.js:355:32)\r\n    at Function.Module._load (module.js:310:12)\r\n    at Module.require (module.js:365:17)\r\n    at require (module.js:384:17)\r\n    at Object.<anonymous> (/Users/doug/gulptmp/gulpfile.babel.js:2:30)\r\n    at Module._compile (module.js:460:26)\r\n```\r\n\r\nModules in node_modules  seem to not be compiled?\r\n\r\nAlthough this... kind of makes sense, it's annoying in a very real sense.\r\n\r\nThis is the situation I currently have:\r\n\r\n- Project A has a module gulp setup with a variety of tasks defined in gulp/taskA.js, gulp/taskB.js, etc.\r\n\r\n- Project B uses Project A as a library.\r\n\r\nIdeally, B could npm install A, and then use this from the local gulpfile.babel.js:\r\n\r\n```\r\nimport * as scripts from 'A/gulp/tasks/scripts';\r\n\r\ngulp.task('child-scripts', ['scripts']);\r\n```\r\n\r\n...and indeed, if A is in raw javascript, it works. However, if A uses es6 gulp files, the import fails (as shown in the linked example).\r\n\r\nThe solution is to clone A as a submodule in B, and that works too... but it's not ideal, for all the reasons that using npm at all makes sense.\r\n\r\nSo, two questions:\r\n\r\n1) Is there a good reason not to invoke babel on node_modules? \r\n\r\n2) Is this a 'bug' or a 'feature'; in that, will it ever be fixed, or is this something that I need to find a long term work around for?\r\n\r\n...or am I just 'doing it wrong'? The documentation on gulpfile.bable.js is pretty sparse, but as far as I can see I would expect what I'm doing to work...?"},"comment":{"url":"https://api.github.com/repos/gulpjs/gulp/issues/comments/199420054","html_url":"https://github.com/gulpjs/gulp/issues/1234#issuecomment-199420054","issue_url":"https://api.github.com/repos/gulpjs/gulp/issues/1234","id":199420054,"user":{"login":"phated","id":992373,"avatar_url":"https://avatars.githubusercontent.com/u/992373?v=3","gravatar_id":"","url":"https://api.github.com/users/phated","html_url":"https://github.com/phated","followers_url":"https://api.github.com/users/phated/followers","following_url":"https://api.github.com/users/phated/following{/other_user}","gists_url":"https://api.github.com/users/phated/gists{/gist_id}","starred_url":"https://api.github.com/users/phated/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phated/subscriptions","organizations_url":"https://api.github.com/users/phated/orgs","repos_url":"https://api.github.com/users/phated/repos","events_url":"https://api.github.com/users/phated/events{/privacy}","received_events_url":"https://api.github.com/users/phated/received_events","type":"User","site_admin":false},"created_at":"2016-03-21T18:42:20Z","updated_at":"2016-03-21T18:42:20Z","body":"Support questions should be directed to StackOverflow.  I am going to lock this issue, as it has become a dumping ground for all comments about babel."}}