-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
93 lines (92 loc) · 2.72 KB
/
vite.config.ts
File metadata and controls
93 lines (92 loc) · 2.72 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
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
import path from "path"
import { defineConfig } from "vite"
import solidPlugin from "vite-plugin-solid"
import legacy from "@vitejs/plugin-legacy"
import { dynamicBase } from "vite-plugin-dynamic-base"
import { viteStaticCopy } from "vite-plugin-static-copy"
export default defineConfig({
resolve: {
alias: {
"~": path.resolve(__dirname, "src"),
// "@solidjs/router": path.resolve(__dirname, "solid-router/src"),
"solid-icons": path.resolve(__dirname, "node_modules/solid-icons"),
},
},
plugins: [
solidPlugin(),
legacy({
targets: ["defaults"],
}),
dynamicBase({
// dynamic public path var string, default window.__dynamic_base__
publicPath: " window.__dynamic_base__",
// dynamic load resources on index.html, default false. maybe change default true
transformIndexHtml: true,
transformIndexHtmlConfig: {
insertBodyAfter: true,
},
}),
process.env.VITE_LITE !== "true"
? viteStaticCopy({
targets: [
{
src: "node_modules/monaco-editor/min/*",
dest: "static/monaco-editor",
},
{
src: "node_modules/katex/dist/katex.min.css",
dest: "static/katex",
},
{
src: "node_modules/katex/dist/fonts/*",
dest: "static/katex/fonts",
},
{
src: "node_modules/mermaid/dist/mermaid.min.js",
dest: "static/mermaid",
},
{
src: "node_modules/@ruffle-rs/ruffle/*.{js,wasm}",
dest: "static/ruffle",
},
{
src: "node_modules/libheif-js/libheif-wasm/libheif.{js,wasm}",
dest: "static/libheif",
},
{
src: "node_modules/libass-wasm/dist/js/subtitles-octopus-worker.{js,wasm}",
dest: "static/libass-wasm",
},
{
src: "src/components/artplayer-plugin-ass/fonts/*",
dest: "static/fonts",
},
],
})
: null,
],
base: process.env.NODE_ENV === "production" ? "/__dynamic_base__/" : "/",
// base: "/",
build: {
// target: "es2015", //next
// polyfillDynamicImport: false,
},
// experimental: {
// renderBuiltUrl: (filename, { type, hostId, hostType }) => {
// if (type === "asset") {
// return { runtime: `window.OPENLIST_CONFIG.cdn/${filename}` };
// }
// return { relative: true };
// },
// },
server: {
host: "0.0.0.0",
proxy: {
"/api": {
target: "http://localhost:5244",
changeOrigin: true,
// rewrite: (path) => path.replace(/^\/api/, ""),
},
},
},
})