-
Notifications
You must be signed in to change notification settings - Fork 21
/
vite.config.ts
74 lines (72 loc) · 1.94 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
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
import importMetaUrlPlugin from '@codingame/esbuild-import-meta-url-plugin'
import { viteStaticCopy } from 'vite-plugin-static-copy'
import { normalizePath } from 'vite'
import path from 'node:path'
import svgr from "vite-plugin-svgr"
// https://vitejs.dev/config/
export default defineConfig({
optimizeDeps: {
esbuildOptions: {
// @ts-ignore // TODO
plugins: [importMetaUrlPlugin]
},
exclude: ['Projects']
},
build: {
// Relative to the root
// Note: This has to match the path in `server/index.mjs` and in `tsconfig.json`
outDir: 'client/dist',
},
plugins: [
react(),
svgr({
// svgr options: https://react-svgr.com/docs/options/
svgrOptions: { exportType: "default", ref: true, svgo: false, titleProp: true },
include: "**/*.svg",
}),
nodePolyfills({
overrides: {
fs: 'memfs',
},
}),
viteStaticCopy({
targets: [
{
src: [
normalizePath(path.resolve(__dirname, './node_modules/@leanprover/infoview/dist/*')),
normalizePath(path.resolve(__dirname, './node_modules/lean4monaco/dist/webview/webview.js')),
],
dest: 'infoview'
},
{
src: [
normalizePath(path.resolve(__dirname, './node_modules/@leanprover/infoview/dist/codicon.ttf'))
],
dest: 'assets'
}
]
})
],
publicDir: "client/public/",
base: "/", // setting this to `/leanweb/` means the server is now accessible at `localhost:3000/leanweb`
server: {
port: 3000,
proxy: {
'/websocket': {
target: 'ws://localhost:8080',
ws: true
},
'/api': {
target: 'http://localhost:8080',
},
}
},
resolve: {
alias: {
path: "path-browserify",
},
},
})