Reputation: 157
I'm trying to start Express.js server with react application that I downloaded, but when I do npm start on my server there is error
ERROR in ./src/app.jsx
Module build failed: SyntaxError: Unexpected token (6:7)
4 | import 'react-select/dist/react-select.css';
5 |
> 6 | render(<div>Place your application here</div>, document.getElementById('app-root'));
Why would it be?
Upvotes: 1
Views: 764
Reputation: 157
Finally got it working by settings presets in webpack.config:
presets:['es2015','react']
- for error Uncaught SyntaxError: Unexpected token import
and npm install babel-preset-react
+ babel-preset-es2015
Upvotes: 0
Reputation: 1587
Try using this
import React from 'react';
import ReactDOM from 'react-dom';
import 'react-select/dist/react-select.css';
ReactDOM.render(
< div > Place your application here < /div>,
document.getElementById('root'));
Upvotes: 1