Forráskód Böngészése

feat: unocss 更新unocss版本及配置,解决unocss 虚拟配置重复引用问题

jiegangwu 8 hónapja
szülő
commit
9a3bfff2d8
6 módosított fájl, 219 hozzáadás és 205 törlés
  1. 1 1
      package.json
  2. 196 201
      pnpm-lock.yaml
  3. 3 2
      src/main.ts
  4. 1 1
      src/pages.json
  5. 1 0
      src/style/uno.scss
  6. 17 0
      uno.config.ts

+ 1 - 1
package.json

@@ -145,7 +145,7 @@
     "rollup-plugin-visualizer": "^5.12.0",
     "sass": "1.77.8",
     "typescript": "^5.7.2",
-    "unocss": "66.0.0",
+    "unocss": "66.4.2",
     "unplugin-auto-import": "^0.17.8",
     "vite": "5.2.8",
     "vite-plugin-restart": "^0.4.2",

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 196 - 201
pnpm-lock.yaml


+ 3 - 2
src/main.ts

@@ -6,8 +6,9 @@ import { routeInterceptor } from './router/interceptor'
 
 import store from './store'
 import '@/style/index.scss'
-import 'virtual:uno.css'
-
+// import 'virtual:uno.css'
+import '@/style/uno.scss'
+// 替换 virtual:uno.css
 export function createApp() {
   const app = createSSRApp(App)
   app.use(store)

+ 1 - 1
src/pages.json

@@ -89,4 +89,4 @@
       ]
     }
   ]
-}
+}

+ 1 - 0
src/style/uno.scss

@@ -0,0 +1 @@
+@unocss;

+ 17 - 0
uno.config.ts

@@ -9,6 +9,23 @@ import {
 } from 'unocss'
 
 export default defineConfig({
+  // 添加此配置避免重复扫描
+  content: {
+    pipeline: {
+      exclude: [
+        'node_modules',
+        '.git',
+        'dist',
+        '**/*.d.ts',
+        '__uno.css', // 🚨 排除警告中的问题文件
+      ],
+    },
+  },
+  // 添加此配置
+  include: [
+    './src/**/*.{vue,js,ts,jsx,tsx}',
+    './src/style/uno.scss', // 指定新入口
+  ],
   presets: [
     presetUni({
       attributify: {