forked from skittleskittles/Human_AI_Interaction
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
82 lines (81 loc) · 2.33 KB
/
Copy pathwebpack.config.js
File metadata and controls
82 lines (81 loc) · 2.33 KB
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
77
78
79
80
81
82
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const Dotenv = require('dotenv-webpack');
module.exports = {
entry: {
main: "./src/index.js",
},
output: {
filename: "[name].bundle.js",
path: path.resolve(__dirname, "dist"),
clean: true, // Ensures old files are removed
publicPath: "",
},
mode: "development", // production
devServer: {
static: {
directory: path.resolve(__dirname, "dist"),
},
historyApiFallback: true, // Ensures proper routing
hot: true,
port: 3000,
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-env"],
},
},
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
},
{
test: /\.(png|jpg|gif|svg)$/,
type: "asset/resource",
},
{
test: /\.(mp4|mov)$/i,
type: "asset/resource",
generator: {
filename: "videos/[name][ext]",
},
},
],
},
optimization: {
usedExports: true, // Removes unused functions
},
plugins: [
new Dotenv(),
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
filename: "index.html", // Generates dist/index.html
chunks: ["main"],
template: "./pages/index.html",
}),
new CopyWebpackPlugin({
patterns: [
{ from: "assets", to: "" },
{ from: "./pages/consent.html", to: "consent.html" },
{ from: "./pages/instructions.html", to: "instructions.html" },
{ from: "./pages/modal.html", to: "modal.html" },
{ from: "./pages/feedback.html", to: "feedback.html" },
{ from: "./styles/instruction.css", to: "instruction.css" },
{ from: "./styles/instructionPage2.css", to: "instructionPage2.css" },
{ from: "./styles/instructionPage4.css", to: "instructionPage4.css" },
{ from: "./styles/instructionPage5.css", to: "instructionPage5.css" },
{ from: "./styles/instructionPage7.css", to: "instructionPage7.css" },
{ from: "./styles/instructionPage9.css", to: "instructionPage9.css" },
],
}),
],
};