Section 1: Construction of es6 development environment

Chapter 1: Construction of es6 development environment

  Command: npm init -y   generates a package.json file (dependency file); the project structure is as follows:

The command to install babel-cli globally is as follows: npm install -g babel-cli,

 

You also need to install babel-preset-es2015 and babel-cli locally

 

Then install it in the project: npm install --save-dev babel-preset-es2015 babel-cli

Package es6 into code that can be recognized by es5:

babel src/index.js -o dish/index.js  
Configure the shortcut startup method in package.json:

Then run npm run build (those who have used vue-cli should be familiar with this command);

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324477686&siteId=291194637