-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathvite.config.js
More file actions
38 lines (34 loc) · 920 Bytes
/
vite.config.js
File metadata and controls
38 lines (34 loc) · 920 Bytes
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
const { defineConfig } = require('vite');
const react = require('@vitejs/plugin-react');
const path = require('path');
const fs = require('fs');
// Read SSL certificates
const certPath = path.resolve(__dirname, 'certs/localhost.pem');
const keyPath = path.resolve(__dirname, 'certs/localhost-key.pem');
if (!fs.existsSync(certPath) || !fs.existsSync(keyPath)) {
throw new Error(`SSL certificates not found. Expected:\n ${certPath}\n ${keyPath}`);
}
const httpsConfig = {
cert: fs.readFileSync(certPath),
key: fs.readFileSync(keyPath),
};
module.exports = defineConfig({
plugins: [react.default()],
root: 'src/ui',
publicDir: 'public',
build: {
outDir: '../../dist',
emptyOutDir: true,
chunkSizeWarningLimit: 1000,
},
server: {
port: 52390,
strictPort: true,
https: httpsConfig,
hmr: {
protocol: 'wss',
host: 'localhost',
port: 52390,
},
},
});