forked from Byteonic-Labs/litheum-bco
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
54 lines (53 loc) · 1.63 KB
/
vite.config.js
File metadata and controls
54 lines (53 loc) · 1.63 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
// vite.config.js
import { defineConfig } from 'vite';
import { resolve } from 'path';
// Custom dev server rewrite plugin
function routeRewriter() {
return {
name: 'html-route-rewriter',
configureServer(server) {
server.middlewares.use((req, res, next) => {
const url = req.url;
if (url === '/') {
// stake.litheum.com
req.url = '/stake/index.html';
console.log('Rewriting to stake/index.html');
} else if (url === '/public') {
req.url = '/public-offering/index.html';
} else if (url === '/status') {
req.url = '/status/index.html';
} else if (url === '/private') {
req.url = '/private/index.html';
} else if (url === '/dex') {
// swap.litheum.com ------> localhost:5173/dex
req.url = '/dex/index.html';
} else if (url === '/pool') {
// swap.litheum.com/pool -------> localhost:5173/pool
req.url = '/pool/index.html';
} else if (url === '/runner') {
// runner.litheum.com
req.url = '/runner/index.html';
}
next();
});
}
};
}
export default defineConfig({
root: '.',
appType: 'mpa',
build: {
outDir: 'dist',
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
public: resolve(__dirname, 'public-offering/index.html'),
dex: resolve(__dirname, 'dex/index.html'),
pool: resolve(__dirname, 'pool/index.html'),
runner: resolve(__dirname, 'runner/index.html'),
// contact: resolve(__dirname, 'contact.html'),
},
},
},
plugins: [routeRewriter()]
});