How it works...

Installing webpack with npm downloads the published package to the node_modules directory. Because webpack also includes an executable, it is installed under node_modules/.bin.

The webpack configuration is fairly simple. It specifies an entry point and an output. The entry point defines where webpack begins its traversal. Next, it visits all the modules that are imported by the entry point and then all the modules imported by those. This is repeated until all the dependencies have been visited.

Then all the dependencies are merged into a single file. The file location is defined by the output settings. In this case, the output is defined as bundle.js. The output bundles are placed in the current directory.

You can visit the ...

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.