After reading Teacher Ruan Yifeng’s tutorial, I looked at it vaguely. Can you guys please see where I went wrong?
The first step is to configure. Configure the .babelIrc stuff in the root directory, so I used sublime to create a .babelIrc folder in the new folder under BabelDemo, but how do I write code into the folder? Woolen cloth? I am creating a json under .babelIrc?
The second step is to start downloading the npm module in confusion
My editor at this time
I'm completely confused at this point, and I can't understand the tutorial at all. I feel so tired. The company does not use es6, and there is no front-end leader. What matters to us is that the back-end speaks JS junk language without looking at ES6. I want to learn by myself and set up a node.js environment. I have been stuck for a month to understand npm. After I know how to use nodejs npm, I want to learn babel. I want to create a hello.js written in es6 in a directory and convert it to es5. . I didn’t expect it to be so difficult. Hey
Can any kind-hearted person teach me how to use babel under windows? I’d be very grateful
.babelrc
是文件名不是目录名,安装好了babel-cli
就可以直接命令行babel demo.js -o index.babel.js
index.babel.js
就是编译过的文件。这就是最简单的
babel
编译过程木凳口袋。。。你确定你知道node怎么用?报错报的no such file啊没有package.json啊,你起码先npm init一下啊,人家说创建.babelrc文件,你创建个文件夹,是啊文件夹怎么写内容啊,我天哪大妹子你也知道文件夹不能写代码啊,你倒是把package.json建到这下面了,package.json干啥用的你确定你知道?babelrc只是个配置文件,babel-cli离了他也是可以工作的,你把package.json都搞错了。
要学 es6 语法,还不如直接在线上练,http://babeljs.io/repl
阮一峰老师的教程写的很清楚是在根目录下新建.babelIrc文件,而不是文件夹。