fix: add https support for local vite dev server

This commit is contained in:
Xiaohan-Tian
2026-04-18 14:27:07 -07:00
parent 474b68c494
commit 7e67ca9d10
5 changed files with 81 additions and 7 deletions
+3 -1
View File
@@ -1,5 +1,6 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import mkcert from 'vite-plugin-mkcert';
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { fileURLToPath, URL } from 'node:url';
@@ -11,12 +12,13 @@ const version = packageJson.version;
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
plugins: [react(), mkcert()],
base: '/kgstudio/',
define: {
__APP_VERSION__: JSON.stringify(version),
},
server: {
host: true,
// IMPORTANT: MAKE SURE TO UPDATE YOUR OS HOSTS FILE TO POINT `testlocal.com` TO YOUR LOCAL IP (e.g. 127.0.0.1).
allowedHosts: ['testlocal.com', '.testlocal.com', 'localhost', '127.0.0.1'],
},