mirror of
				https://github.com/soybeanjs/soybean-admin.git
				synced 2025-11-04 15:53:43 +08:00 
			
		
		
		
	fix(projects): fix proxy config
This commit is contained in:
		@@ -6,8 +6,8 @@ import { createServiceConfig } from '../../src/utils/service';
 | 
			
		||||
 *
 | 
			
		||||
 * @param env - The current env
 | 
			
		||||
 */
 | 
			
		||||
export function createViteProxy(env: Env.ImportMeta) {
 | 
			
		||||
  const isEnableHttpProxy = env.DEV && env.VITE_HTTP_PROXY === 'Y';
 | 
			
		||||
export function createViteProxy(env: Env.ImportMeta, isDev: boolean) {
 | 
			
		||||
  const isEnableHttpProxy = isDev && env.VITE_HTTP_PROXY === 'Y';
 | 
			
		||||
 | 
			
		||||
  if (!isEnableHttpProxy) return undefined;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,7 @@ import { setupVitePlugins } from './build/plugins';
 | 
			
		||||
import { createViteProxy } from './build/config';
 | 
			
		||||
 | 
			
		||||
export default defineConfig(configEnv => {
 | 
			
		||||
  console.log('configEnv: ', configEnv);
 | 
			
		||||
  const viteEnv = loadEnv(configEnv.mode, process.cwd()) as unknown as Env.ImportMeta;
 | 
			
		||||
 | 
			
		||||
  const buildTime = dayjs().format('YYYY-MM-DD HH:mm:ss');
 | 
			
		||||
@@ -33,7 +34,7 @@ export default defineConfig(configEnv => {
 | 
			
		||||
      host: '0.0.0.0',
 | 
			
		||||
      port: 9527,
 | 
			
		||||
      open: true,
 | 
			
		||||
      proxy: createViteProxy(viteEnv),
 | 
			
		||||
      proxy: createViteProxy(viteEnv, configEnv.command === 'serve'),
 | 
			
		||||
      fs: {
 | 
			
		||||
        cachedChecks: false
 | 
			
		||||
      }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user