From 02409bfbe15f22fc3b5dccadabfd860a660a49d9 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Sat, 11 Oct 2025 10:37:14 +0800
Subject: [PATCH] feat: 名称修改

---
 vite.config.mjs |   55 ++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 42 insertions(+), 13 deletions(-)

diff --git a/vite.config.mjs b/vite.config.mjs
index df3da37..9a62dc8 100644
--- a/vite.config.mjs
+++ b/vite.config.mjs
@@ -1,19 +1,20 @@
-import { defineConfig, loadEnv } from 'vite';
-import { resolve } from 'path';
-import createVitePlugins from './vite/plugins';
+import { defineConfig, loadEnv } from 'vite'
+import { resolve } from 'path'
+import createVitePlugins from './vite/plugins'
+import postCssPxToRem from 'postcss-pxtorem'
 // https://vitejs.dev/config/
 export default ({ mode, command }) => {
-  const env = loadEnv(mode, process.cwd());
-  const { VITE_APP_ENV, VITE_APP_BASE } = env;
+  const env = loadEnv(mode, process.cwd())
+  const { VITE_APP_ENV, VITE_APP_BASE, VITE_APP_URL, VITE_APP_MAP_TILE_URL } = env
   // 判断是打生产环境包
-  const isProd = VITE_APP_ENV === 'production';
+  const isProd = VITE_APP_ENV === 'production'
 
   // 根据是否生产环境,动态设置压缩配置
   const buildConfig = {
     outDir: 'manage',
     target: 'esnext',
     minify: isProd ? 'terser' : 'esbuild', // 根据环境选择压缩工具
-  };
+  }
 
   // 如果是生产环境,添加Terser的配置
   if (isProd) {
@@ -25,7 +26,7 @@
       format: {
         comments: false, // 删除所有注释
       },
-    };
+    }
   }
   return defineConfig({
     base: VITE_APP_BASE,
@@ -35,16 +36,23 @@
       __INTLIFY_PROD_DEVTOOLS__: false,
     },
     server: {
-      port: 2888,
+      port: 5174,
+      // host: '192.168.1.178',
       proxy: {
         '/api': {
-          target: 'http://localhost',
-          // target: 'https://wrj.shuixiongit.com/api',
+          target: VITE_APP_URL,
           changeOrigin: true,
           rewrite: path => path.replace(/^\/api/, ''),
         },
+
+        '/3Dtile': {
+          target: VITE_APP_MAP_TILE_URL,
+          changeOrigin: true,
+          rewrite: path => path.replace(/^\/3Dtile/, ''),
+        },
       },
     },
+    assetsInclude: ['**/*.gltf'],
     resolve: {
       alias: {
         '~': resolve(__dirname, './'),
@@ -54,6 +62,27 @@
         utils: resolve(__dirname, './src/utils'),
       },
     },
+    css: {
+      preprocessorOptions: {
+        scss: {
+          api: 'modern-compiler',
+          additionalData: `@use "@/styles/variables.scss" as *;`,
+        },
+      },
+      postcss: {
+        plugins: [
+          postCssPxToRem({
+            rootValue: 10, // 指定转换基准值,通常是设计稿宽度的1/10
+            propList: ['*'], // 可以从px转换为rem的属性,这里是所有属性
+            unitPrecision: 5, // 允许REM单位增长到的十进制数
+            selectorBlackList: [], // 选择器黑名单,忽略转换的选择器
+            replace: true, // 替换包含rem的规则,而不是添加回退
+            mediaQuery: false, // 允许在媒体查询中转换px
+            minPixelValue: 0 // 设置要替换的最小像素值
+          }),
+        ]
+      }
+    },
     plugins: createVitePlugins(env, command === 'build'),
     build: buildConfig,
     optimizeDeps: {
@@ -61,5 +90,5 @@
         target: 'esnext',
       },
     },
-  });
-};
+  })
+}

--
Gitblit v1.9.3