forked from SHSGames/shsgames.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
75 lines (73 loc) · 1.52 KB
/
vite.config.ts
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
import { defineConfig, normalizePath } from "vite";
import react from "@vitejs/plugin-react";
import { config } from "dotenv";
import pjson from "./package.json";
import manifest, { base } from "./app/manifest.json";
import { VitePWA } from "vite-plugin-pwa";
import htmlPlugin from "vite-plugin-html-config";
import path from "path";
config();
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
VitePWA({
srcDir: "app",
registerType: "autoUpdate",
scope: base,
manifest: <unknown>manifest,
workbox: {
globIgnores: [
"**\/IodineGBA\/index.html",
"**\/node_modules\/**\/*"
]
}
}),
htmlPlugin({
metas: [ {
name: "description",
content: manifest.description
}, {
name: "theme-color",
content: manifest.theme_color
} ],
links: [ {
rel: "apple-touch-icon",
href: "/apple_touch_icon.png"
} ]
})
],
base,
define: {
"PRODUCTION": process.env.NODE_ENV?.toLowerCase() === "production",
"APP_MANIFEST": {
name: manifest.name,
version: pjson.version,
description: manifest.description,
author: pjson.author
}
},
root: "app",
server: {
port: 8080,
hmr: {
protocol: "ws",
host: "localhost"
},
proxy: {
"/api": {
target: `http://localhost:${process.env.PORT || pjson.webserver.http.port}`,
changeOrigin: true
}
}
},
build: {
outDir: "../public_html"
},
resolve: {
alias: {
"styles": path.resolve(__dirname, "./app/styles"),
"pages": path.resolve(__dirname, "./app/pages")
}
}
});