fix: fix cnb basic ssl

This commit is contained in:
abearxiong 2025-04-28 13:38:17 +08:00
parent 53a7070a7b
commit 2279d7108a
2 changed files with 9 additions and 2 deletions

2
.gitignore vendored
View File

@ -28,3 +28,5 @@ tsconfig.app.tsbuildinfo
tsconfig.node.tsbuildinfo tsconfig.node.tsbuildinfo
.turbo .turbo
.pnpm-store

View File

@ -5,11 +5,15 @@ import pkgs from './package.json';
import tailwindcss from '@tailwindcss/vite'; import tailwindcss from '@tailwindcss/vite';
import basicSsl from '@vitejs/plugin-basic-ssl'; import basicSsl from '@vitejs/plugin-basic-ssl';
import dotenv from 'dotenv'; import dotenv from 'dotenv';
dotenv.config({ path: '.env.development' });
const version = pkgs.version || '0.0.1'; const version = pkgs.version || '0.0.1';
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'development';
const basename = isDev ? '/' : pkgs?.basename || '/'; const basename = isDev ? '/' : pkgs?.basename || '/';
const plugins = [react(), tailwindcss(), basicSsl()]; const plugins = [react(), tailwindcss()];
dotenv.config({ path: '.env.development' }); const isCNB = process.env.CNB === 'true';
if (isDev && !isCNB) {
plugins.push(basicSsl());
}
let target = process.env.VITE_API_URL || 'http://localhost:3000'; let target = process.env.VITE_API_URL || 'http://localhost:3000';
let proxy = { let proxy = {
'/root/center/': { '/root/center/': {
@ -59,6 +63,7 @@ export default defineConfig(() => {
server: { server: {
port: 7008, port: 7008,
host: '0.0.0.0', host: '0.0.0.0',
allowedHosts: true,
proxy, proxy,
}, },
}; };