我正在尝试使用 babel-node 运行 relay-starter-kit updateSchema.js。它似乎无法识别箭头功能:
> SyntaxError: .../build/updateSchema.js: Unexpected token (10:9)
8 |
9 | // Save JSON of full schema introspection for Babel Relay Plugin to use
> 10 | async () => {
| ^
我尝试将预设“stage-0”添加到“.babelrc”以修复该错误,但我得到:
SyntaxError: .../build/updateSchema.js: Unexpected token (23:1)
21 | );
22 | }
> 23 | }();
| ^
这不是识别es2015吗?还是我的模式中有错误?脚本"updateSchema.js"来自 relay-starter-kit。
其他一切运行良好,“babel-node”似乎对我用 es2015 编写的应用程序的其余部分没有问题。
编辑: 我现在尝试只下载 relay-starter-kit 并运行“npm run update-schema”,它开箱即用。
最佳答案
你在入口点需要 babel-core
吗?
首先 npm install --save-dev babel-core
然后打开应用程序的入口点文件
然后通过 require("babel-core");
babel-core
关于javascript - babel-node 不识别 es2015?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33992985/