I have been following the react: up and running book by stoyan stephanov. Chapter 5. I am stuck at the command:
babel --presets react,es2015 js/source -d js/build
result: es2015 does not exist.
But when I try: babel --presets react js/source -d js/build
it works as expected in the book.
And then I write: babel --presets react,es2015 js/source -d js/build
result: Syntax error at app.js. Unexpected token before h1 tag.
App.js code
'use strict';
import React from 'react';
import ReactDOM from 'react-dom';
import Logo from './components/Logo';
ReactDOM.render(
<h1>
Welcome to the app!
</h1>,
document.getElementById('app')
);
All optional presets must be installed manually, as far as I know:
npm install --save-dev babel-preset-es2015
PS Here are some additional data on issue.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.