In the previous recipe, we saw how to use the babel-polyfill
library to support new ES methods. This add methods to the language at runtime, so that source code that depends on them runs correctly.
There are other language features that are relatively new to ECMAScript, such as the arrow function, let and const variable declarations, and spread operators. These features are not universally supported. Babel provides a mechanism to use them at the source level, and remain compatible with a build step.
This recipe demonstrates how to use Babel within webpack, in order to support these features in older browsers.
This recipe assumes that you have the code created in earlier recipes in this chapter, and that you have installed Python. Please visit these earlier recipes or copy the code.