Using Bundles and Content Security
Modern web development requires three key components: the backend server, the client-side application, and the browser. Earlier chapters have demonstrated how the Node.js API – and its add-on packages – can be used to receive and process HTTP requests. Now it is time to explore how the server-side part of the application has to work together with the other components.
This chapter covers two topics that shape the way the parts of an application fit together. The first topic is using a bundler. The client-side part of an application usually consists of a large number of files, and these are gathered together and compressed into a small number of files for efficiency. This is done by a bundler and most of the widely used client-side frameworks, such as Angular and React, provide developer tools that use a bundler named webpack. In the first part of the chapter, I explain how webpack works and describe the different ways that it can...