I am trying to create a React application by tutorial .
app / main.js
var React = require('react'); var ReactDOM = require('react-dom'); ReactDOM.render( <h1>Hello, world!</h1>, document.getElementById('example') );
webpack.config.js
module.exports = { entry: './app/main.jsx', output: { filename: 'app.js' }, module: { loaders: [ { test: /\.(js|jsx)$/, exclude: /node_modules/, loader: 'babel-loader' } ], resolve: { extensions: ['', '.js', '.jsx'] } } };
An error occurs:
Module build failed: SyntaxError: E: \ app \ main.jsx: Unexpected token (6: 2)
What am I doing wrong?
weback-dev-server
when thewebpack
command is written in the dock. BUT, when I studied entering thereact
, I was looking for good manuals for a long time, I found only 1 - maxfarseer.gitbooks.io/redux-course-ru/content/chapter1.html , which really opened up the light to me. Do everything for him, because There the architecturally correct creation of the application goes, throughnpm
and collectors. Everything is simple enough for a beginner. Oddly enough, the docks off changed from the moment of my studying, to the worse, the beginning always went from initializingnpm
- Vasily Barbashev