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:
@ -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()]
|
||||
});
|
||||
|
Reference in New Issue
Block a user