-
Notifications
You must be signed in to change notification settings - Fork 4
/
frontend.webpack.config.js
76 lines (75 loc) · 1.65 KB
/
frontend.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
import HtmlWebpackPlugin from "html-webpack-plugin";
import path from "path";
import { sveltePreprocess } from "svelte-preprocess";
export default (_, options) => ({
entry: {
index: "./src/frontend/index.ts",
},
mode: "production",
module: {
rules: [
{
test: /\.svelte$/u,
use: {
loader: "svelte-loader",
options: {
preprocess: sveltePreprocess({
sourceMap: options.mode === "development",
tsconfigFile: "./frontend.tsconfig.json",
}),
},
},
},
{
test: /\.ts$/u,
use: {
loader: "ts-loader",
options: {
onlyCompileBundledFiles: true,
},
},
},
{
test: /\.css$/u,
use: ["style-loader", "css-loader"],
},
{
test: /\.(sa|sc)ss$/u,
use: [
"style-loader",
"css-loader",
{
loader: "sass-loader",
options: {
sassOptions: {
includePaths: ["./src/frontend", "./node_modules"],
},
},
},
],
},
],
},
output: {
filename: "[name].js",
publicPath: "",
},
performance: {
hints: false,
},
plugins: [
new HtmlWebpackPlugin({
inject: false,
minify: false,
template: "src/frontend/index.html",
}),
],
resolve: {
alias: {
svelte: path.resolve("node_modules", "svelte/src/runtime"),
},
conditionNames: ["svelte", "require", "node"],
extensions: [".ts", ".js", ".svelte"],
mainFields: ["svelte", "browser", "module", "main"],
},
});