- 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
14 lines
370 B
JavaScript
14 lines
370 B
JavaScript
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()]
|
|
});
|