{"action":"created","issue":{"url":"https://api.github.com/repos/babel/babel-loader/issues/198","repository_url":"https://api.github.com/repos/babel/babel-loader","labels_url":"https://api.github.com/repos/babel/babel-loader/issues/198/labels{/name}","comments_url":"https://api.github.com/repos/babel/babel-loader/issues/198/comments","events_url":"https://api.github.com/repos/babel/babel-loader/issues/198/events","html_url":"https://github.com/babel/babel-loader/issues/198","id":126080555,"number":198,"title":"babel-loader 6.2.1 does not recognize JSX syntax","user":{"login":"pkosenko","id":4556807,"avatar_url":"https://avatars.githubusercontent.com/u/4556807?v=3","gravatar_id":"","url":"https://api.github.com/users/pkosenko","html_url":"https://github.com/pkosenko","followers_url":"https://api.github.com/users/pkosenko/followers","following_url":"https://api.github.com/users/pkosenko/following{/other_user}","gists_url":"https://api.github.com/users/pkosenko/gists{/gist_id}","starred_url":"https://api.github.com/users/pkosenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkosenko/subscriptions","organizations_url":"https://api.github.com/users/pkosenko/orgs","repos_url":"https://api.github.com/users/pkosenko/repos","events_url":"https://api.github.com/users/pkosenko/events{/privacy}","received_events_url":"https://api.github.com/users/pkosenko/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-01-12T02:06:16Z","updated_at":"2016-07-24T07:41:28Z","closed_at":null,"body":"Reference Stackoverflow (the topic has comments disabled):\r\n\r\nhttp://stackoverflow.com/questions/33460420/babel-loader-jsx-syntaxerror-unexpected-token\r\n\r\nNone of the answers in this post seem to work for me. I was compiling straight from Babel 5 (babel app.js -o bundle.js) with no problem. But when I attempted to switch over to webpack with Babel 6 with a webpack.config.js file, all of a sudden the babel-loader was having trouble recognizing JSX syntax embedded in the main app.js file. \r\n     Line 70: Unexpected token <\r\n     You may need an appropriate loader to handle this file type.   ???????\r\n     |     return (\r\n     |        <div>\r\n\r\nSo there is something screwed up in webpack or babel-loader.  \r\n\r\nAdding \"react\" presets to the .babelrc file or to the webpack.config.js files does NOT solve the problem as was indicated in the Stackoverflow.   That suggests that there is something broken with the babel-loader version that I am using.\r\n\r\nI have global install of Babel version 5.8.23 (babel-core 5.8.24) vs. local webpack install of \"babel-loader\" version 6.2.1.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/babel/babel-loader/issues/comments/234763117","html_url":"https://github.com/babel/babel-loader/issues/198#issuecomment-234763117","issue_url":"https://api.github.com/repos/babel/babel-loader/issues/198","id":234763117,"user":{"login":"TannerPerrien","id":1613103,"avatar_url":"https://avatars.githubusercontent.com/u/1613103?v=3","gravatar_id":"","url":"https://api.github.com/users/TannerPerrien","html_url":"https://github.com/TannerPerrien","followers_url":"https://api.github.com/users/TannerPerrien/followers","following_url":"https://api.github.com/users/TannerPerrien/following{/other_user}","gists_url":"https://api.github.com/users/TannerPerrien/gists{/gist_id}","starred_url":"https://api.github.com/users/TannerPerrien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TannerPerrien/subscriptions","organizations_url":"https://api.github.com/users/TannerPerrien/orgs","repos_url":"https://api.github.com/users/TannerPerrien/repos","events_url":"https://api.github.com/users/TannerPerrien/events{/privacy}","received_events_url":"https://api.github.com/users/TannerPerrien/received_events","type":"User","site_admin":false},"created_at":"2016-07-24T07:41:28Z","updated_at":"2016-07-24T07:41:28Z","body":"Leaving a note here in case someone has the same issue as me. Babel's [docs](https://babeljs.io/docs/setup/) show the webpack setup as such:\r\n```\r\nmodule: {\r\n  loaders: [\r\n    {\r\n      test: /\\.js$/,\r\n      exclude: /node_modules/,\r\n      loader: \"babel-loader\"\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\nAnd this is fine as long as your `jsx` code is in file with a `.js` extension. It is [recommended](https://github.com/facebook/react/issues/832) to use the `.jsx` file extension, but if you do this without updating the webpack config, webpack will not use the babel loader to process the `.jsx` files.\r\n\r\nYou can easily fix by updating your config to process both `.js` and `.jsx` files:\r\n```\r\nmodule: {\r\n  loaders: [\r\n    {\r\n      test: /\\.(js|jsx)$/,\r\n      exclude: /node_modules/,\r\n      loader: \"babel-loader\"\r\n    }\r\n  ]\r\n}\r\n```"}}
{"actor":{"display_login":"TannerPerrien"}}