-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.dev.js
106 lines (104 loc) · 2.64 KB
/
config.dev.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
"use strict";
const HtmlPlugin = require("html-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const DashboardPlugin = require("webpack-dashboard/plugin");
const path = require("path");
module.exports = {
mode: "development",
entry: {
main: path.resolve(__dirname, "src/js/main.js"),
nav: path.resolve(__dirname, "src/js/nav.js"),
},
output: {
assetModuleFilename: "img/[name].[contenthash][ext]",
path: path.resolve(__dirname, "dist"),
filename: "[name].js",
},
devServer: {
static: {
directory: path.join(__dirname, "dist"),
},
compress: true,
open: true,
port: 8080,
},
devtool: "inline-source-map",
module: {
rules: [
{
test: /\.html$/i,
use: ["html-loader"],
exclude: /node_modules/,
},
{
test: /\.(svgz?|png|jpe?g|gif)$/i,
type: "asset/resource",
},
{
test: /\.css$/i,
use: [
"style-loader", // 2. inject styles into DOM
"css-loader", // 1. translate css into commonjs
],
},
{
test: /\.s[ac]ss$/i,
use: [
"style-loader", // 3. inject styles into DOM
"css-loader", // 2. turn css into commonjs
"sass-loader", // 1. turn sass into css
],
},
],
},
plugins: [
new HtmlPlugin({
chunks: ["main", "nav"],
filename: "./index.html",
inject: "head",
scriptLoading: "defer",
template: path.resolve(__dirname, "src/index.raw.html"),
}),
new HtmlPlugin({
chunks: ["nav"],
filename: "./impressum.html",
inject: "head",
scriptLoading: "defer",
template: path.resolve(__dirname, "src/impressum.raw.html"),
}),
new HtmlPlugin({
chunks: ["nav"],
filename: "./datenschutz.html",
inject: "head",
scriptLoading: "defer",
template: path.resolve(__dirname, "src/datenschutz.raw.html"),
}),
new CopyPlugin({
patterns: [
{
from: path.resolve(__dirname, "src/img/duene/*.jpg"),
to: "img/duene/[name][ext]",
},
{
from: path.resolve(__dirname, "src/img/moewe/*.jpg"),
to: "img/moewe/[name][ext]",
},
{
from: path.resolve(__dirname, "src/img/sellin/*opt*"),
to: "img/sellin/[name][ext]",
},
{
from: path.resolve(__dirname, "src/data"),
to: "data",
},
],
}),
new DashboardPlugin(),
],
// By default webpack logs warnings if the bundle is bigger than 200kb.
performance: { hints: false },
watch: false,
watchOptions: {
ignored: /node_modules/,
},
};