ECMAScript6 project environment construction

first step

node installation

Download | Node.js Chinese Network

After the installation is successful, check the version number in the command window, if there is a version number, the installation is successful

 second step

Then map the Taobao mirror npm config set registry  https://registry.npm.taobao.org

third step

# Initialize the project with default configuration

npm init -y

Entering npm init -y in the integrated terminal will generate a package.json package

the fourth step

Then install the corresponding dependencies

babel-cli: a command line tool that allows us to enter some babel commands

babel-preset-es2015: rule set, how to convert the code (to be converted to es2015 or ES6)

#Local installation of babel-cli and corresponding conversion rules

npm install --save-dev babel-cli babel-preset-es2015

 

the fifth step

Create a new .babelrc file ( note the previous point )

//Configure the ruleset for transforming the current code

{

"presets": ["es2015"]

}

Configure the package.json file

//Translate all es6 files in the src directory and output them to the dist directory

"buildall":"babel src -w -d dist"

 

Supongo que te gusta

Origin blog.csdn.net/qq_51402804/article/details/123705560
Recomendado
Clasificación