[英]React.js transpile issue. Babel build commands not working
I have been following the react: up and running book by stoyan stephanov. 我一直在关注反应:由stoyan stephanov撰写并运行的书。 Chapter 5. I am stuck at the command: 第5章。我受命令的约束:
babel --presets react,es2015 js/source -d js/build babel --presets react,es2015 js / source -d js / build
result: es2015 does not exist. 结果:es2015不存在。
But when I try: babel --presets react js/source -d js/build 但是当我尝试时: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 然后我写:babel --presets react,es2015 js / source -d js / build
result: Syntax error at app.js. 结果:app.js出现语法错误。 Unexpected token before h1 tag. h1标签之前的意外令牌。
App.js code App.js代码
'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')
);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.