From 2800fa4f32f3900509cb4d6eefaf2bfaf54efdd7 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Mon, 21 Apr 2025 18:29:09 +0800
Subject: [PATCH] fix: 天气显示

---
 vite.config.mjs |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/vite.config.mjs b/vite.config.mjs
index f5f278b..bad375a 100644
--- a/vite.config.mjs
+++ b/vite.config.mjs
@@ -4,6 +4,8 @@
 } from 'vite';
 import { resolve } from 'path'
 import createVitePlugins from './vite/plugins';
+import postCssPxToRem from 'postcss-pxtorem'
+
 // https://vitejs.dev/config/
 export default ({
   mode,
@@ -61,6 +63,7 @@
         },
       },
     },
+    assetsInclude: ['**/*.gltf'],
     resolve: {
       alias: {
         '~': resolve(__dirname, './'),
@@ -77,6 +80,19 @@
           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,

--
Gitblit v1.9.3