chore: 规范化常量配置
This commit is contained in:
parent
261dd5bb67
commit
eecc2b1893
2
apps/designer/src/constants/env.ts
Normal file
2
apps/designer/src/constants/env.ts
Normal file
@ -0,0 +1,2 @@
|
||||
// @ts-ignore
|
||||
export const currentEnv = __APP_ENV__;
|
1
apps/designer/src/constants/index.ts
Normal file
1
apps/designer/src/constants/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from './env';
|
@ -2,6 +2,15 @@ export const devMode = 'development';
|
||||
|
||||
export const prodMode = 'production';
|
||||
|
||||
export const isDevMode = import.meta.env.DEV;
|
||||
export const stagingMode = 'staging';
|
||||
|
||||
export const isProdMode = import.meta.env.PROD;
|
||||
// @ts-ignore
|
||||
export const currentEnv = __APP_ENV__;
|
||||
|
||||
export const isDevMode = import.meta.env.MODE === devMode;
|
||||
export const isProdMode = import.meta.env.MODE === prodMode;
|
||||
export const isStagingMode = import.meta.env.MODE === stagingMode;
|
||||
|
||||
export const Y_CODE_RENDERER_URL = currentEnv.Y_CODE_RENDERER_URL;
|
||||
export const Y_CODE_DESIGNER_URL = currentEnv.Y_CODE_DESIGNER_URL;
|
||||
export const Y_CODE_PLATFORM_URL = currentEnv.Y_CODE_PLATFORM_URL;
|
||||
|
@ -1 +1,2 @@
|
||||
export * from '@sy/low-code-shared/constants';
|
||||
// export * from '@sy/low-code-shared/constants';
|
||||
export * from './env';
|
||||
|
@ -1,4 +1,5 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
import { Y_CODE_RENDERER_URL } from '@/constants';
|
||||
|
||||
// 微前端路由
|
||||
const moduleName = 'application';
|
||||
@ -20,11 +21,11 @@ const routes: Array<RouteRecordRaw> = [
|
||||
keepAlive: true,
|
||||
icon: 'ant-design:list',
|
||||
app: {
|
||||
url: 'https://localhost:10010',
|
||||
url: Y_CODE_RENDERER_URL,
|
||||
name: 'y-code-platform-application-list',
|
||||
sync: true,
|
||||
alive: true,
|
||||
degrade: true,
|
||||
// sync: true,
|
||||
// alive: true,
|
||||
// degrade: true,
|
||||
applicationId: 0,
|
||||
projectId: 4,
|
||||
fileId: 'b91n1y9yr',
|
||||
|
@ -1,4 +1,5 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
import { Y_CODE_DESIGNER_URL } from '@/constants';
|
||||
|
||||
// 微前端路由
|
||||
const moduleName = 'micro';
|
||||
@ -19,7 +20,7 @@ const routes: Array<RouteRecordRaw> = [
|
||||
title: '低代码编辑器',
|
||||
icon: 'ant-design:edit-outlined',
|
||||
app: {
|
||||
url: 'https://localhost:10011',
|
||||
url: Y_CODE_DESIGNER_URL,
|
||||
name: 'y-code-designer',
|
||||
applicationId: 4,
|
||||
// sync: true,
|
||||
|
@ -1,4 +1,5 @@
|
||||
import type { RouteRecordRaw } from 'vue-router';
|
||||
import { Y_CODE_RENDERER_URL } from '@/constants';
|
||||
|
||||
// 微前端路由
|
||||
const moduleName = 'project';
|
||||
@ -20,7 +21,7 @@ const routes: Array<RouteRecordRaw> = [
|
||||
keepAlive: true,
|
||||
icon: 'ant-design:list',
|
||||
app: {
|
||||
url: 'https://localhost:10010',
|
||||
url: Y_CODE_RENDERER_URL,
|
||||
name: 'y-code-platform-project-list',
|
||||
// sync: true,
|
||||
// alive: true,
|
||||
|
@ -26,7 +26,8 @@ const __APP_INFO__ = {
|
||||
export default ({ command, mode }: ConfigEnv): UserConfig => {
|
||||
console.log('mode', mode);
|
||||
// 环境变量
|
||||
const env = loadEnv(mode, process.cwd(), ['VITE_', 'VTJ_', 'SY_']);
|
||||
const env = loadEnv(mode, process.cwd(), ['VITE_', 'VTJ_', 'SY_', 'Y_CODE_']);
|
||||
console.log('env', env);
|
||||
const isDev = command === 'serve';
|
||||
|
||||
return {
|
||||
@ -46,6 +47,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
|
||||
server: {
|
||||
open: true,
|
||||
host: true,
|
||||
port: Number(env.VITE_PORT),
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'https://custom-chart-pre-api.shiyue.com',
|
||||
|
@ -5,7 +5,7 @@ VITE_NODE_ENV = 'development'
|
||||
VITE_BASE_URL = /
|
||||
|
||||
# 前端可见变量(必须以 VITE_ 开头)
|
||||
VITE_PORT = 10010
|
||||
VITE_PORT = 10012
|
||||
# VITE_BASE_API_URL = 'https://custom-chart-pre-api.shiyue.com/'
|
||||
VITE_BASE_API_URL = 'https://custom-chart-api.shiyuegame.com/'
|
||||
|
||||
|
@ -7,7 +7,7 @@ import path from "path";
|
||||
// @ts-ignore
|
||||
export default defineConfig(({ mode }) => {
|
||||
console.log("mode", mode);
|
||||
const env = loadEnv(mode, process.cwd(), ["VITE_"]);
|
||||
const env = loadEnv(mode, process.cwd(), ["VITE_", "Y_CODE_"]);
|
||||
|
||||
return {
|
||||
server: {
|
||||
|
2
apps/renderer/src/constants/env.ts
Normal file
2
apps/renderer/src/constants/env.ts
Normal file
@ -0,0 +1,2 @@
|
||||
// @ts-ignore
|
||||
export const currentEnv = __APP_ENV__;
|
1
apps/renderer/src/constants/index.ts
Normal file
1
apps/renderer/src/constants/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export * from "./env";
|
@ -1,7 +1,7 @@
|
||||
# .env.development
|
||||
VITE_NODE_ENV = development
|
||||
|
||||
VITE_PORT = 10012
|
||||
VITE_PORT = 10013
|
||||
|
||||
VITE_OA_BASEURL = https://oa-pre.shiyue.com
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user