problems

Uncaught ReferenceError: regeneratorRuntime is not defined when compiling ES6 with Babel

Question why

The script using ES7 async/await regeneratorRuntime is not recognized by the browser and requires the @babel/ plugin-transform-Runtime plugin

Solution:

First, install dependencies

npm install --save @babel/runtime 
npm install --save-dev @babel/plugin-transform-runtime
Copy the code

Step 2. Configure Babel

// babel.config.js
module.exports = {
  presets: ['@babel/preset-env'.'@vue/cli-plugin-babel/preset'].plugins: [['@babel/transform-runtime']]};Copy the code