From a411e6a6e8baf3a0f0ebf6255f312669903d3754 Mon Sep 17 00:00:00 2001
From: haoxuan <haoxuan>
Date: 星期一, 22 一月 2024 17:38:23 +0800
Subject: [PATCH] 安装适配样式的插件和配置vite+调整页面样式

---
 vite.config.ts |   89 +++++++++++++++++++++++++++++---------------
 1 files changed, 58 insertions(+), 31 deletions(-)

diff --git a/vite.config.ts b/vite.config.ts
index 4e64e31..6c9c574 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -6,8 +6,10 @@
 import IconsResolver from 'unplugin-icons/resolver'
 import Icons from 'unplugin-icons/vite'
 import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
-// 鍏煎浣庣増鏈祻瑙堝櫒
-import legacy from '@vitejs/plugin-legacy'
+// 鎵撳寘 鍏煎浣庣増鏈祻瑙堝櫒
+// import legacy from '@vitejs/plugin-legacy'
+// 寮�鍙戠幆澧冨吋瀹�
+import esbuild from 'rollup-plugin-esbuild'
 const pathSrc = path.resolve(__dirname, 'src')
 
 // https://vitejs.dev/config/
@@ -15,7 +17,8 @@
   server: {
     proxy: {
       '/v1/': {
-        target: 'http://192.168.20.119:8003',
+        // http://192.168.20.119:8003
+        target: 'http://192.168.20.25:7010',
         ws: true,
         changeOrigin: true
       }
@@ -28,8 +31,23 @@
   },
   
   build: {
+    minify:'terser',
+    // ,'edge90','firefox90','safari15'
     target:['chrome52'],
     cssTarget:["chrome52"],
+  },
+  css:{
+      postcss:{
+          plugins:[
+            require('postcss-pxtorem')({
+              // ipad:1280-800
+              rootValue:160.0, //鎹㈢畻鐨勫熀鏁帮紝 灞忓箷瀹藉害/10
+              propList:['*'],//闇�瑕佽浆鍖栫殑灞炴�э紝*琛ㄧず鎵�鏈夊睘鎬ч兘闇�瑕佽浆鍖�
+              // unitPrecision:5
+            })
+          ]
+    }
+
   },
   plugins: [
     vue(),
@@ -48,32 +66,40 @@
 
       dts: path.resolve(pathSrc, 'auto-imports.d.ts')
     }),
-   
-    // 鍏煎浣庣増鏈祻瑙堝櫒
-    legacy({
-      targets: ['defaults', 'ie >= 11', 'chrome < 60','firefox < 59'], //闇�瑕佸吋瀹圭殑鐩爣鍒楄〃锛屽彲浠ヨ缃涓�
-      additionalLegacyPolyfills: ['regenerator-runtime/runtime'],
-      renderLegacyChunks: true,
-      modernPolyfills:true,
-      polyfills: [
-        'es.symbol',
-        'es.array.filter',
-        'es.promise',
-        'es.promise.finally',
-        'es/map',
-        'es/set',
-        'es.array.for-each',
-        'es.object.define-properties',
-        'es.object.define-property',
-        'es.object.get-own-property-descriptor',
-        'es.object.get-own-property-descriptors',
-        'es.object.keys',
-        'es.object.to-string',
-        'web.dom-collections.for-each',
-        'esnext.global-this',
-        'esnext.string.match-all'
-      ]
+    // 寮�鍙戠幆澧冨吋瀹�
+    esbuild({
+      target:"chrome64",
+      loaders:{
+        ".vue":'js',
+        ".ts":'js'
+      }
     }),
+    // 鍏煎浣庣増鏈祻瑙堝櫒
+    // legacy({
+    //   // ie >= 11
+    //   targets: ['defaults', 'not IE 11', 'chrome < 60','firefox < 59'], //闇�瑕佸吋瀹圭殑鐩爣鍒楄〃锛屽彲浠ヨ缃涓�
+    //   additionalLegacyPolyfills: ['regenerator-runtime/runtime'],
+    //   // renderLegacyChunks: true,
+    //   modernPolyfills:true,
+    //   polyfills: [
+    //     'es.symbol',
+    //     'es.array.filter',
+    //     'es.promise',
+    //     'es.promise.finally',
+    //     'es/map',
+    //     'es/set',
+    //     'es.array.for-each',
+    //     'es.object.define-properties',
+    //     'es.object.define-property',
+    //     'es.object.get-own-property-descriptor',
+    //     'es.object.get-own-property-descriptors',
+    //     'es.object.keys',
+    //     'es.object.to-string',
+    //     'web.dom-collections.for-each',
+    //     'esnext.global-this',
+    //     'esnext.string.match-all'
+    //   ]
+    // }),
     Components({
       resolvers: [
         // 鑷姩娉ㄥ唽鍥炬爣缁勪欢
@@ -89,9 +115,10 @@
       autoInstall: true
     }),
   ],
-  configureWebpack:config=>{
-    config.entry.app=['babel-polyfill','./src/main.js']
-  },
+  // configureWebpack:config=>{
+  //   config.entry.app=['babel-polyfill','./src/main.js']
+  // },
+  // transpileDependencies:['*']
   // chainWebpack: (config) => {
   //   config.entry('main').add('babel-polyfill')
   // },

--
Gitblit v1.8.0