Introduction

In the preceding chapter, we covered how to take advantage of the new ECMAScript modules to load code from multiple files and organize our code. This cutting-edge technique has only recently become available in browsers. In practice, production websites try to target as many users as possible. This often means targeting older browsers. In addition, JavaScript also runs in other environments (such as Node.js) that do not support ECMAScript modules.

The good news is that we don't have to change our source code in order to support these platforms. There are tools available that produce a single JavaScript file from multiple source files. This way we can use modules to organize our code, and run our programs on more platforms.

Get ECMAScript Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.