Simple example of using Babel to turn ES6 syntax to ES5

Preface
Babel is a widely used transcoder that converts the ES6 code to an ES5 code to execute in an existing environment.

This means that you can write programs with ES6 now, don’t worry about whether the existing environment is supported. 利用babel将es6语法转es5的简单示例

This article explains the pre-installed Node and NPM. You can refer to this article: https://www.jb51.net/Article/90518.htm, this is a very detailed detail.


Generate Pack Management Profile package.json

利用babel将es6语法转es5的简单示例

NPM INIT -Y


   
NPM I -G Babel-Clinpm i –save-dev babel-rep-es 2015 Babel-Cli


The following is written in the .babelrc file
  {"PRESETS": ["ES2015"], "plugins": [] }  
Compilation file


Babel SRC / Test.js -O Dist / test.js
   Summary 
The above is the full content of this article. I hope this paper has a certain reference value for everyone’s learning or work. If you have any questions, you can leave a message, thank you for your support of Tumi Cloud.

© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment