- Building Enterprise JavaScript Applications
- Daniel Li
- 134字
- 2021-07-23 16:31:12
Adding Babel CLI and polyfill
We'll be using the Babel CLI to transpile our code, while also adding the Babel polyfill in order to make use of newer JavaScript APIs. Therefore, while still inside your project directory, run the following two commands:
$ yarn add @babel/core @babel/cli --dev
$ yarn add @babel/polyfill
We used the --dev flag when we ran yarn add @babel/core @babel/cli, and this is because we want to include them as development dependencies. Development dependencies may include build tools, test runners, documentation generators, linters, and anything else that are used during development, but not used by the application itself.
This is done so that if someone wants to use our package in their project, they can just npm install our package and its dependencies, without also downloading the development dependencies.