Setting up webpack

Now, we will install webpack, which will be used to build your project. Webpack is a module bundler. It is used to bundle, transform, and package various files to be used in a browser. This includes JavaScript, JSX, HTML, and assets.

The advantages of using a module bundler, such as webpack, are listed as follows:

  • It can bundle various kinds of JavaScript modules: ES Modules, CommonJS, and AMD.
  • It works together with Babel to transpile newer JavaScript syntax, such as ES2015.
  • Not just JavaScript, but various files can be preprocessed during compilation. For example, images can be converted to base64, or template files can be compiled into HTML.
  • It can create a single bundle or multiple chunks. Splitting your code into ...

Get Learning Redux 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.