While it's neat that we can compile Webpack with a single command, in reality, you'll almost always want to use a dedicated
webpack.config.js file to configure your Webpack build. Let's transition over in this episode.
The term "module" used to scare me. What exactly are they? Well, as it turns out, the answer is very simple: they're just files. Let's experiment with importing and exporting modules, while taking a few moments to discuss CommonJS vs. ES2015 modules.
Let's move on and review Webpack loaders. Loaders allow us to transform and preprocess any number of file types. Maybe you'd like to require Sass files, or compile ES2015 with Babel, or even inject CSS into the browser's
head tag. Let's review the process of requiring CSS in this episode.
You'll likely want to use some form of CSS preprocessor in your workflow. In this lesson, I'll demonstrate how to compile Sass, as part of your Webpack build. It's easy!
Easily, one of the most common points of confusion for developers switching to Webpack from a tool like Gulp stems from how Webpack (and
css-loader) processes relative URLs within your stylesheets. It's essential that you understand the concepts in this lesson, so don't skip it!
In this episode, we'll review file hashing in Webpack. This allows you to apply automatic unique hashes to each generated file. This way, we can instruct our server and browser to cache the file for as long as possible. Let's start reviewing everything you need to know.
We're able to successfully version (hash) our bundled chunks, but now we have a new problem: if the file hash keeps changing, how do we reference it in our HTML? We can no longer hardcode the path. Instead, let's have webpack generate a
manifest.json file. This way, using Ruby, PHP, or fill-in-the-blank, we can read this file and dynamically determine and fetch the proper hash.
At this stage in your learning, most of your webpack plugin interaction will consist of installing and instantiating whatever you need. For most common tasks, a plugin has already been created and is up on npm. However, a plugin can do anything and everything. As such, you'll likely encounter situations where it's useful to construct your own custom plugins, even if they're only intended for your personal use. In this episode, we'll review how easy it is to do so.