-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
60 lines (58 loc) · 2.19 KB
/
vite.config.js
File metadata and controls
60 lines (58 loc) · 2.19 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
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';
import generouted from '@generouted/react-router/plugin';
// https://vitejs.dev/config/
export default defineConfig(function (_a) {
var mode = _a.mode;
// Load env file based on `mode` in the current working directory.
// Set the third parameter to '' to load all env regardless of the `VITE_` prefix.
var env = loadEnv(mode, process.cwd());
return {
plugins: [react(), generouted()],
base: env.VITE_BASE_URL,
server: {
port: 5176,
fs: {
allow: ['..']
},
middlewares: [
(req, res, next) => {
// Force proper MIME type for vector tiles
if (req.url.endsWith('.pbf')) {
res.setHeader('Content-Type', 'application/x-protobuf');
res.removeHeader('Content-Disposition'); // Prevent download
// Override any existing content-type to ensure it's set
const _writeHead = res.writeHead;
res.writeHead = function(status, headers) {
if (headers) {
headers['Content-Type'] = 'application/x-protobuf';
}
return _writeHead.apply(this, arguments);
};
console.log('Serving vector tile:', req.url);
}
next();
}
]
},
// Configure build settings
build: {
// Ensure large files are properly handled
chunkSizeWarningLimit: 2000,
rollupOptions: {
output: {
manualChunks: {
// Split vendor modules
vendor: ['react', 'react-dom', '@deck.gl/core', '@deck.gl/layers', 'mapbox-gl']
}
}
}
},
// Configure resolve aliases if needed
resolve: {
alias: {
// Add any necessary aliases here
}
}
};
});