-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
76 lines (68 loc) · 1.89 KB
/
webpack.config.js
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const isProd = process.env.NODE_ENV !== "production";
module.exports = {
mode: process.env.NODE_ENV,
performance: {
hints: false,
maxEntrypointSize: 512000,
maxAssetSize: 512000,
},
entry: "./src/index.js",
devtool: isProd ? "eval-cheap-module-source-map" : "source-map",
output: {
path: path.join(__dirname, "/build"),
publicPath: "/",
pathinfo: true,
filename: process.env.NODE_ENV === "production" ? "[name].[chunkhash].js" : "[name].[fullhash].js",
chunkFilename: process.env.NODE_ENV === "production" ? "chunk.[name].[chunkhash].js" : "chunk.[name].[fullhash].js",
libraryTarget: "umd",
clean: true, // Clean the output directory before emit.
assetModuleFilename: "[name][ext]",
sourceMapFilename: "[name].js.map",
},
plugins: [
new HtmlWebpackPlugin({
filename: "index.html",
favicon: "./src/Components/Favicon/favicon-32x32.png",
template: "./src/index.html",
minify: {
removeComments: true,
removeAttributeQuotes: true,
collapseWhitespace: true,
collapseBooleanAttributes: true,
},
inject: true,
hash: true,
title: "development",
description: "Just copy/paste my actual stuff here",
}),
],
devServer: {
port: 3000,
historyApiFallback: true,
},
module: {
rules: [
{
test: /\.js$/,
use: {
loader: "babel-loader",
options: { presets: ["@babel/preset-env", "@babel/preset-react"] },
},
},
{
test: /\.css$/,
use: [{ loader: "style-loader" }, { loader: "css-loader" }],
},
{
test: /\.(png|jpg|webp|mp4|wav|svg)$/,
type: "asset/resource",
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/i,
type: "asset/resource",
},
],
},
};