-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
71 lines (69 loc) · 2.02 KB
/
Copy pathvite.config.ts
File metadata and controls
71 lines (69 loc) · 2.02 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
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import { defineConfig } from 'vite'
import { viteStaticCopy } from 'vite-plugin-static-copy'
const rootDir = fileURLToPath(new URL('.', import.meta.url))
export default defineConfig({
optimizeDeps: {
// Pre-bundle runtime worker dependencies during dev startup so the first
// "Run" action doesn't trigger Vite's late dependency optimization reload.
include: ['emception/worker', 'pyodide', '@electric-sql/pglite', 'sql.js'],
},
plugins: [
react(),
tailwindcss(),
viteStaticCopy({
targets: [
{
src: 'node_modules/emception/public/cdn/**/*',
dest: 'cdn',
rename: { stripBase: 4 },
},
],
}),
],
server: {
host: 'localhost',
port: 5173,
strictPort: true,
allowedHosts: ['localhost', '127.0.0.1', '.loca.lt', '.lhr.life', '.localhost.run'],
headers: {
'Cross-Origin-Opener-Policy': 'same-origin',
'Cross-Origin-Embedder-Policy': 'require-corp',
},
proxy: {
'/git-proxy': {
target: 'https://github.com',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/git-proxy/, ''),
configure: (proxy) => {
proxy.on('proxyReq', (proxyReq) => {
proxyReq.removeHeader('origin')
proxyReq.removeHeader('referer')
proxyReq.setHeader('user-agent', 'git/isomorphic-git')
})
// Strip WWW-Authenticate so the browser never shows its native login popup
proxy.on('proxyRes', (proxyRes) => {
delete proxyRes.headers['www-authenticate']
})
},
},
},
},
preview: {
host: 'localhost',
port: 5173,
strictPort: true,
headers: {
'Cross-Origin-Opener-Policy': 'same-origin',
'Cross-Origin-Embedder-Policy': 'require-corp',
},
},
resolve: {
alias: {
'@': path.resolve(rootDir, 'src'),
},
},
})