- Building Enterprise JavaScript Applications
- Daniel Li
- 53字
- 2021-07-23 16:31:13
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.