Skip to content

Getting Started with Babel

Hannah edited this page Dec 22, 2020 · 2 revisions

Install Babel and Babel CLI

Babel is a toolchain that is mainly used to convert ECMAScript 2015+ code into a backwards compatible version of JavaScript in current and older browsers

Source: babeljs.io

  1. From the project root, run npm i to install node_modules from package-lock.json.
  2. Save ES2015+ JavaScript under the src folder, which is where Babel looks for JS files to compile.
  3. Alternatively, edit the build and watch scripts in package.json to direct Babel to your JS folder.
  4. Use npm run build to manually compile JavaScript to the public folder.
  5. Auto-compile every time you save an update using npm run watch.

Next Step

Clone this wiki locally