In the previous two recipes, we saw how to create a client bundle and load it into a browser. This make it possible to use ES modules in source code without breaking compatibility with older browsers.
However, there are also new methods available in newer versions of the language that we'll be using in later chapters.
This recipe demonstrates how to use the babel-polyfill
library to support those methods.
This recipe assumes that you have the code created in earlier recipes in this chapter, and that you have installed Python and know how to start the static HTTP server. Please visit the earlier recipes or copy the code.
- Open your command line application and navigate to the directory containing the
02-creating-client-bundles
package. - Start the Python HTTP server.
- Update the
main.js
file to use theArray.prototype.values
method, and usefor..of
to loop over the resulting iterator:
import { atlas, saturnV } from './rockets/index.js...