ECMAScript Cookbook
上QQ阅读APP看书,第一时间看更新

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 webpack docs for more detail on how it works and how to configure it for different scenarios at:  https://webpack.js.org/ .