

assets/images is also where we programmed Webpack to look for images in configurations above. in an assets directory that contains corresponding sub directories for each type of resource (such as assets/images, assets/fonts, etc.). But it's common practice to house resources images, fonts, icons, etc. We can now begin adding images to our site! There's no strict, universal rule for where to place image files.

const path = require('path') Ĭonst HtmlWebpackPlugin = require('html-webpack-plugin') If you've been following along carefully with all lessons thus far, your entire updated configuration file looks like this: As stated in this loader's GitHub Documentation this dependency invokes Webpack to load the corresponding image resource for any tags it spots in our HTML.

html file types should have our new html-loader applied to them. The second test section begins a new rule for.

You may wonder why we must use Webpack to display an image on our site. So let's make sure we understand how to work with images in a Webpack-driven environment. Most modern sites include at least a few images. However, there's still something we're missing: Images. Our Webpack-driven projects have really been coming together.
