Building Enterprise JavaScript Applications
上QQ阅读APP看书,第一时间看更新

Importing the Babel polyfill

Lastly, inside the src/index.js file, import the polyfill at the top of the file:

import "@babel/polyfill";
...

This will allow us to use new JavaScript APIs, such as fetch. Again, transpile the modified source code by executing rm -rf dist/ && npx babel src -d dist.