-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
78 lines (75 loc) · 2.02 KB
/
vite.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
77
78
import { execSync } from "child_process";
import path from "path";
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react";
import tsconfigPaths from "vite-tsconfig-paths";
import { VitePWA } from "vite-plugin-pwa";
import { viteStaticCopy } from "vite-plugin-static-copy";
const fullHash = execSync("git rev-parse HEAD").toString().trim();
export default defineConfig(({ mode }) => {
process.env = { ...process.env, ...loadEnv(mode, __dirname), VITE_GIT_HASH: fullHash };
return {
root: "./src/",
server: {
hmr: {
protocol: "ws",
host: "localhost",
},
},
build: {
sourcemap: true,
outDir: path.resolve(__dirname, "dist"),
},
plugins: [
tsconfigPaths({
root: __dirname,
}),
react({
jsxImportSource: "@emotion/react",
babel: {
parserOpts: {
plugins: ["decorators-legacy", "classProperties", "@emotion/babel-plugin"],
},
},
}),
VitePWA({
manifest: {
name: "RemoWeb",
short_name: "RemoWeb",
description: "Web client for Nature Remo",
background_color: "#000000",
theme_color: "#90caf9",
icons: [
{
src: "/assets/pwa-192x192.png",
sizes: "192x192",
type: "image/png",
},
{
src: "/assets/pwa-512x512.png",
sizes: "512x512",
type: "image/png",
},
],
},
injectRegister: null,
}),
viteStaticCopy({
targets: [
{
src: path.resolve(__dirname, "src/assets/pwa-192x192.png"),
dest: "assets",
},
{
src: path.resolve(__dirname, "src/assets/pwa-512x512.png"),
dest: "assets",
},
],
}),
],
esbuild: {
// REF: https://github.com/vitejs/vite/issues/8644
logOverride: { "this-is-undefined-in-esm": "silent" },
},
};
});