Add html-loader, file-loader, and clean-webpack-plugin

- Added html-loader to automatically require the files we reference in img tags
- Added file-loader to handle the svg,png,jpg,gif files from our images
- Configured file-loader to add our images to an imgs directory in dist
- Also configured it to add a hash to their filenames
- Lastly, added clean-webpack-plugin to our production config to clean out the dist directory each time we build
This commit is contained in:
Colt Steele
2019-03-05 18:13:21 -08:00
parent eb66c0dc93
commit 947290016d
6 changed files with 155 additions and 33 deletions

View File

@ -1,11 +1,13 @@
const path = require("path");
const common = require("./webpack.common");
const merge = require("webpack-merge");
const CleanWebpackPlugin = require("clean-webpack-plugin");
module.exports = merge(common, {
mode: "production",
output: {
filename: "main.[contentHash].js",
path: path.resolve(__dirname, "dist")
}
},
plugins: [new CleanWebpackPlugin()]
});