-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.prod.js
More file actions
34 lines (33 loc) · 910 Bytes
/
webpack.prod.js
File metadata and controls
34 lines (33 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const TerserPlugin = require("terser-webpack-plugin");
module.exports = {
mode: "production",
entry: ["./src/index.js"],
devtool: "source-map", // Keeps source maps for debugging production code
optimization: {
minimize: true, // Enable JavaScript minification
minimizer: [new TerserPlugin()],
},
plugins: [
new HtmlWebpackPlugin({
template: "./index.html", // Path to your index.html in the root directory
}),
],
module: {
rules: [
{
test: /\.(png|jpe?g|jpg)$/i,
loader: "file-loader",
options: {
name: "[path][name].[ext]",
outputPath: "assets", // Places image files in 'assets' folder
},
},
],
},
output: {
filename: "main.js",
path: path.resolve(__dirname, "dist"), // Output directory
},
};