wupengfei
2025-04-15 bcc758429cc2f438765246a973ccff9f33668315
fix: bug
1个文件已添加
4个文件已修改
38 ■■■■ 已修改文件
.env.jx 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
build/plugins.ts 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
types/global.d.ts 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
vite.config.ts 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.env.jx
New file
@@ -0,0 +1,23 @@
NODE_ENV=production
# 线上环境项目打包路径
VITE_PUBLIC_PATH = /
# 线上环境路由历史模式
VITE_ROUTER_HISTORY = "h5"
# 线上环境后端地址
# VITE_PROXY_DOMAIN_REAL = "https://818api.rlwyyun.com"
VITE_PROXY_DOMAIN_REAL = "https://api.jx818.com"
# 是否为打包后的文件提供传统浏览器兼容性支持 支持 true 不支持 false
VITE_LEGACY = true
VITE_COMPRESSION = "none"
# OSS上传地址
VITE_OSS_URL = "https://parkmanagement.oss-cn-hangzhou.aliyuncs.com/"
VITE_OSS_URL_BUCKET = "parkmanagement"
VITE_WEMAP_KEY = "DYRBZ-ZGPCF-X3OJN-N2AA3-JWUCE-HEBXJ"
VITE_CLIENT_ORIGIN = "https://www.jx818.com"
build/plugins.ts
@@ -44,11 +44,12 @@
type Options = {
  VITE_LEGACY?: ViteEnv['VITE_LEGACY'];
  VITE_COMPRESSION?: ViteEnv['VITE_COMPRESSION'];
  VITE_WEMAP_KEY?: ViteEnv['VITE_WEMAP_KEY'];
  VITE_AppType?: ViteEnv['VITE_AppType'];
};
export function getPluginsList(command: ConfigEnv['command'], options: Options = {}) {
  const { VITE_LEGACY, VITE_COMPRESSION, VITE_AppType } = options;
  const { VITE_LEGACY, VITE_COMPRESSION, VITE_WEMAP_KEY, VITE_AppType } = options;
  // const prodMock = true;
  const lifecycle = process.env.npm_lifecycle_event;
  console.log(lifecycle, command);
@@ -69,6 +70,8 @@
        data: {
          title: Config.title,
          subMenuIconCssPath: SubMenuManager.SubMenuIconCssPath,
          WEMAP_KEY: VITE_WEMAP_KEY,
          isJx: VITE_AppType === 'jx',
        },
      },
    }),
package.json
@@ -4,8 +4,11 @@
  "version": "1.0.0",
  "scripts": {
    "dev": "cross-env vite",
    "dev:jx": "cross-env VITE_AppType=jx vite",
    "build": "cross-env NODE_OPTIONS=--max_old_space_size=16000 vite build",
    "build:jx": "cross-env VITE_AppType=jx vite build --mode jx",
    "build:staging": "cross-env vite build --mode staging",
    "build:jx:staging": "cross-env VITE_AppType=jx vite build --mode staging",
    "build:staging:jenkins": "cross-env NODE_OPTIONS=--max_old_space_size=16000 vite build --mode staging",
    "preview": "vite preview",
    "prepare": "husky install",
types/global.d.ts
@@ -112,7 +112,7 @@
    VITE_COMPRESSION: ViteCompression;
    VITE_WEMAP_KEY:string;
    VITE_CLIENT_ORIGIN:string;
    VITE_AppType: 'one' ;
    VITE_AppType: 'one' | 'jx';
  }
  interface AppConfig {
vite.config.ts
@@ -43,6 +43,7 @@
    VITE_PROXY_DOMAIN,
    VITE_PROXY_DOMAIN_REAL,
    VITE_COMPRESSION,
    VITE_AppType,
  } = warpperEnv(loadEnv(mode, root));
  return {
@@ -90,12 +91,12 @@
            }
          : {},
    },
    plugins: getPluginsList(command, { VITE_LEGACY, VITE_COMPRESSION }),
    plugins: getPluginsList(command, { VITE_LEGACY, VITE_COMPRESSION, VITE_AppType }),
    define: {
      __INTLIFY_PROD_DEVTOOLS__: false,
    },
    build: {
      outDir: `dist/dist-12333Governmentback-${mode}`,
      outDir: `dist/dist-12333Governmentback-${VITE_AppType}-${mode}`,
    },
    optimizeDeps: {
      include: [