-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
68 lines (66 loc) · 1.72 KB
/
webpack.config.js
File metadata and controls
68 lines (66 loc) · 1.72 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
const path = require("path");
const webpack = require("webpack");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const WITH_STEAM = process.env.WITH_STEAM === "true";
const IS_ELECTRON = process.env.IS_ELECTRON === "true";
module.exports = {
mode: process.env.NODE_ENV || "production",
entry: "./js/main.js", // Ihr Haupt-JavaScript-File
target: IS_ELECTRON ? "electron-renderer" : "web",
devtool:
process.env.NODE_ENV === "development" ? "inline-source-map" : "source-map",
devServer: {
static: "./",
port: 8080,
hot: true,
liveReload: true,
watchFiles: ["**/*.js", "**/*.html", "**/*.css"],
},
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "dist"),
clean: true,
},
resolve: {
extensions: [".js", ".json"],
fallback: {
fs: false,
path: false,
},
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-env"],
},
},
},
],
},
optimization: {
minimize: process.env.NODE_ENV !== "development", // Production: Minifizierung aktiv
},
plugins: [
new webpack.DefinePlugin({
"process.env.WITH_STEAM": JSON.stringify(WITH_STEAM ? "true" : "false"),
"process.env.IS_ELECTRON": JSON.stringify(IS_ELECTRON ? "true" : "false"),
}),
new CopyWebpackPlugin({
patterns: [
{
from: path.resolve(__dirname, "assets"),
to: path.resolve(__dirname, "dist", "assets"),
},
{
from: path.resolve(__dirname, "data"),
to: path.resolve(__dirname, "dist", "data"),
},
],
}),
],
};