In our last lesson we covered the first half of what webpack can do for you – bundling your modules. Another amazing feature is webpack’s ability to process and manipulate your code during the compilation step. So, for example, if you would like to use Sass to write your CSS, webpack can compile that for you. Webpack can manage your images and compress and optimize them for use on the web. Webpack can minify and uglify your code. There are tons of things webpack can do, but to access these functions we need to learn more about loaders and plugins.
Go through the "Core Concepts" lessons at Webpack Academy. It starts off with the concepts we’ve already learned, but do the whole thing. The review is valuable and this presenter explains things very clearly. Make sure you take note of the
Go through this tutorial to see examples of using webpack to manage your website’s assets.
Finally, do this tutorial to learn how to let webpack manually manage your index.html and insert your bundle into the page for you!
You don’t need to do the rest of the webpack tutorials at this time, but take a look at what’s offered on the sidebar of their guides page. There are several sweet features that you might want to use in future projects such as code-splitting, lazy-loading, and tree-shaking. Now that you have a handle on webpack’s configuration system adding these features is as easy as using the right plugins and loaders!.
- Read the article Through the pipeline: An exploration of front-end bundlers to find out more about the alternatives to
webpack: rollup, parcel and esbuild.
- Is there anything we can help with up to this point? Do you have something to suggest about this chapter? Let us know in the comments below.
- [10.03.2021] Adding resource for parcel, rollup and esbuild bundlers.