-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvite.config.mjs
More file actions
86 lines (84 loc) · 2.35 KB
/
Copy pathvite.config.mjs
File metadata and controls
86 lines (84 loc) · 2.35 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
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill'
import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill'
const tauriDevHost = process.env.TAURI_DEV_HOST
export default defineConfig({
plugins: [react()],
optimizeDeps: {
esbuildOptions: {
plugins: [
NodeGlobalsPolyfillPlugin({
process: true,
buffer: true,
}),
NodeModulesPolyfillPlugin()
]
}
},
server: {
port: 1234,
strictPort: true,
host: tauriDevHost || undefined,
hmr: tauriDevHost
? {
protocol: 'ws',
host: tauriDevHost,
port: 1235,
}
: undefined,
proxy: {
'/api': {
target: 'http://localhost:9999',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '/.netlify/functions/')
},
'/apple': {
target: 'http://localhost:9999',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/apple/, '/.netlify/functions/apple')
},
'/rss-full': {
target: 'http://localhost:9999',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/rss-full/, '/.netlify/functions/findCast/')
},
'/rss-audio': {
target: 'http://phonograph.app',
changeOrigin: true
},
'/ln': {
target: 'https://listen-api.listennotes.com',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/ln/, '/api/v2/'),
configure: (proxy, options) => {
proxy.on('proxyReq', (proxyReq, req, res) => {
proxyReq.setHeader('X-ListenAPI-Key', process.env.listennotes || 'ebbd0481aa1b4acc8949a9ffeedf4d7b');
proxyReq.setHeader('X-From', 'Gramophone-DEV');
});
}
},
'/search': {
target: 'https://itunes.apple.com',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/search/, '/search')
}
}
},
build: {
outDir: 'dist',
assetsDir: 'assets',
rollupOptions: {
// Force using Rollup instead of Rolldown for JSX compatibility
}
},
resolve: {
alias: {
'public': '/public/'
}
},
define: {
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
global: 'globalThis',
}
})