forked from andotherstuff/chorus
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-https-dev.js
More file actions
39 lines (33 loc) · 1.05 KB
/
start-https-dev.js
File metadata and controls
39 lines (33 loc) · 1.05 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
import { spawn } from 'child_process';
import { readFileSync, writeFileSync } from 'fs';
// Create a temporary vite config that extends the existing one with HTTPS
const httpsViteConfig = `
import { defineConfig, loadConfigFromFile } from 'vite';
import { resolve } from 'path';
export default defineConfig({
server: {
https: {
key: readFileSync('.certs/localhost+2-key.pem'),
cert: readFileSync('.certs/localhost+2.pem'),
},
port: 5173,
host: 'localhost'
},
build: {
outDir: 'dist',
},
plugins: []
});
`;
writeFileSync('vite.config.https.js', httpsViteConfig);
// Start Vite with the HTTPS config
const viteProcess = spawn('npx', ['vite', '--config', 'vite.config.https.js'], {
stdio: 'inherit',
shell: true
});
viteProcess.on('close', (code) => {
console.log(`Vite process exited with code ${code}`);
});
console.log('🚀 Starting HTTPS development server...');
console.log('📱 Your PWA will be available at https://localhost:5173');
console.log('⚠️ You may need to accept the security warning in your browser');