Create a new babel-test/directory under your own directory to enter this directory 1. Install the Babel command and Conversion Library: NPM install babel-cli npm install babel-preset-es2015 2. Create a new folder under the current directory:. BABELRC write in folder: {"Presets": ["./babel-preset-es2015"]} 3. Create a new file Example.es6 with the following contents: Import $ From ' jquery ' Export class MyClass {constructor (name = ' nobody ') {this.name = Name } getmyname () {return this.name; }} 4. Install missing related libraries NPM install Ansi-regex ansi-styles escape-string-regexp has-ansi left-pad Number-is-nan strip-ansi Supports-color line-numbers Execution Code: Babel Example.es6-o Example.js If the also reported error message is missing a module: xxx-xxx installs it npm install xxx-xxx 5. You're done. Then, in the current directory, the ES6 code is converted to ES5 code with the Babel command! File Conversion Example: Babel Example.es6-o example.js Folder conversion Example: babel-d example-es5/example-es6 2015.12.1 Yaoel My contact information: [Email protected] Reference: Online Conversion Babel official information 1
Install and use Babel (es6to5) under Windows command line