-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
39 lines (36 loc) · 1008 Bytes
/
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
const path = require("path")
const fs = require("fs")
// Verzeichnis mit den Eingabedateien
const srcDir = path.resolve(__dirname, "src", "js")
// Liest alle Dateien im src-Verzeichnis
const entry = fs.readdirSync(srcDir).reduce((entries, file) => {
const filePath = path.join(srcDir, file)
const fileName = path.parse(file).name
entries[fileName] = filePath
return entries
}, {})
module.exports = {
mode: "production",
entry: entry,
output: {
path: path.resolve(__dirname, "dist/js"),
filename: "[name].bundle.js" // [name] wird durch den Schlüssel im entry-Objekt ersetzt
},
resolve: {
extensions: [".ts", ".js"]
},
module: {
rules: [
{
test: /\.ts$/,
use: "babel-loader",
exclude: /node_modules/
},
{
test: /\.js$/,
use: "babel-loader",
exclude: /node_modules/
}
]
}
}