Answer the question
In order to leave comments, you need to log in
Webpack throws error, doesn't understand React syntax?
Sel dealt with webpack. I watch the introductory video and repeat after it. Elementary project, but webpack throws an error:
ERROR in ./index.js
Module build failed: SyntaxError: Unexpected token (5:15)
3 | const App = React.createClass({
4 | render() {
> 5 | return <h1>h1 lol</h1>
| ^
6 | }
7 | })
8 |
<section id="target">not rendered yet</section>
const React = require('react')
const App = React.createClass({
render() {
return <h1>h1 lol</h1>
}
})
React.render(<App/>, window.document.getElementById('target'))
module.exports = {
entry: "./index.js",
output: {
path: __dirname,
filename: "bundle.js"
},
module: {
loaders: [
{ loader: "babel" }
]
}
}
Answer the question
In order to leave comments, you need to log in
Guess what you forgot.
https://stackoverflow.com/questions/33460420/babel...
babel didn't enter your jsx because you didn't tell him how to cook it, read the answer here and you'll be happy.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question