Explorar el Código

feat: add 微信调试 TODO

Burt hace 2 años
padre
commit
1c0b6b2142
Se han modificado 3 ficheros con 7 adiciones y 160 borrados
  1. 2 2
      pages.config.ts
  2. 0 155
      src/pages.json
  3. 5 3
      vite.config.ts

+ 2 - 2
pages.config.ts

@@ -1,5 +1,5 @@
 import { defineUniPages } from '@uni-helper/vite-plugin-uni-pages'
-import { isWxProd } from './vite.config'
+import { hideDemoPages } from './vite.config'
 
 export default defineUniPages({
   globalStyle: {
@@ -25,7 +25,7 @@ export default defineUniPages({
     fontSize: '10px',
     iconWidth: '24px',
     spacing: '3px',
-    list: isWxProd
+    list: hideDemoPages
       ? [
           {
             iconPath: 'static/tabbar/home.png',

+ 0 - 155
src/pages.json

@@ -29,12 +29,6 @@
         "pagePath": "pages/index/index",
         "text": "首页"
       },
-      {
-        "iconPath": "static/tabbar/example.png",
-        "selectedIconPath": "static/tabbar/exampleHL.png",
-        "pagePath": "pages/demo/index",
-        "text": "示例"
-      },
       {
         "iconPath": "static/tabbar/personal.png",
         "selectedIconPath": "static/tabbar/personalHL.png",
@@ -51,10 +45,6 @@
         "navigationBarTitleText": "首页"
       }
     },
-    {
-      "path": "pages/demo/index",
-      "type": "page"
-    },
     {
       "path": "pages/login/index",
       "type": "page",
@@ -68,151 +58,6 @@
       "style": {
         "navigationBarTitleText": "我的"
       }
-    },
-    {
-      "path": "pages/demo/demo/clock",
-      "type": "page",
-      "style": {
-        "navigationBarTitleText": "动态时钟"
-      }
-    },
-    {
-      "path": "pages/demo/demo/component-auto-import",
-      "type": "page",
-      "style": {
-        "navigationBarTitleText": "easycom 自动导入"
-      }
-    },
-    {
-      "path": "pages/demo/demo/lottery",
-      "type": "page",
-      "style": {
-        "navigationBarTitleText": "九宫格抽奖"
-      }
-    },
-    {
-      "path": "pages/demo/demo/lottery2",
-      "type": "page",
-      "style": {
-        "navigationBarTitleText": "大转盘抽奖"
-      }
-    },
-    {
-      "path": "pages/demo/demo/mp-weixin-share",
-      "type": "page",
-      "style": {
-        "navigationBarTitleText": "微信分享"
-      }
-    },
-    {
-      "path": "pages/demo/demo/navbar",
-      "type": "page",
-      "style": {
-        "navigationBarTitleText": "自定义导航栏",
-        "navigationStyle": "custom"
-      }
-    },
-    {
-      "path": "pages/demo/demo/pages-auto-import",
-      "type": "page",
-      "style": {
-        "navigationBarTitleText": "pages 自动导入"
-      }
-    },
-    {
-      "path": "pages/demo/demo/pinia",
-      "type": "page",
-      "layout": "display",
-      "style": {
-        "navigationBarTitleText": "pinia+持久化"
-      }
-    },
-    {
-      "path": "pages/demo/demo/request",
-      "type": "page",
-      "style": {
-        "navigationBarTitleText": "request请求+请求拦截"
-      }
-    },
-    {
-      "path": "pages/demo/demo/throughout",
-      "type": "page",
-      "style": {
-        "navigationBarTitleText": "通屏+下拉刷新+自定义导航栏",
-        "enablePullDownRefresh": false,
-        "backgroundColor": "#23c09c",
-        "app-plus": {
-          "titleNView": {
-            "type": "transparent"
-          }
-        },
-        "mp-weixin": {
-          "navigationStyle": "custom"
-        }
-      }
-    },
-    {
-      "path": "pages/demo/demo/uni-ui-icons",
-      "type": "page",
-      "style": {
-        "navigationBarTitleText": "UniUI Icons 使用"
-      }
-    },
-    {
-      "path": "pages/demo/demo/uni-ui",
-      "type": "page",
-      "style": {
-        "navigationBarTitleText": "UniUI 使用"
-      }
-    },
-    {
-      "path": "pages/demo/demo/unocss-icons",
-      "type": "page",
-      "style": {
-        "navigationBarTitleText": "UnoCss Icons 使用"
-      }
-    },
-    {
-      "path": "pages/demo/demo/unocss",
-      "type": "page",
-      "style": {
-        "navigationBarTitleText": "UnoCss 使用"
-      }
-    },
-    {
-      "path": "pages/demo/demo/img-min/index",
-      "type": "page"
-    },
-    {
-      "path": "pages/demo/demo/lottery/big-wheel",
-      "type": "page",
-      "style": {
-        "navigationBarTitleText": "大转盘抽奖"
-      }
-    },
-    {
-      "path": "pages/demo/demo/lottery/nine-grid",
-      "type": "page",
-      "style": {
-        "navigationBarTitleText": "九宫格抽奖"
-      }
-    },
-    {
-      "path": "pages/demo/demo/throughout/index",
-      "type": "page",
-      "style": {
-        "navigationBarTitleText": "通屏+下拉刷新+自定义导航栏",
-        "enablePullDownRefresh": true,
-        "backgroundColor": "#23c09c",
-        "app-plus": {
-          "titleNView": {
-            "type": "transparent"
-          }
-        },
-        "mp-weixin": {
-          "navigationStyle": "custom"
-        }
-      }
     }
   ],
   "subPackages": []

+ 5 - 3
vite.config.ts

@@ -28,8 +28,10 @@ import { visualizer } from 'rollup-plugin-visualizer'
 // 另外,小程序有主包2M的限制,所以一般图片会放到图片服务器(不放本地),那这个插件就没用,所以在开发h5的时候,使用本地图片才用得到,既然如此那就不装吧
 // import viteImagemin from 'vite-plugin-imagemin'
 
-export const isWxProd =
-  process.env.UNI_PLATFORM === 'mp-weixin' && process.env.NODE_ENV === 'production'
+// 微信生产环境、本地真机调试不要demo路由,本地开发可以有;TODO: 下面2个根据使用条件选一个即可
+export const hideDemoPages = process.env.UNI_PLATFORM === 'mp-weixin'
+// export const hideDemoPages =
+//   process.env.UNI_PLATFORM === 'mp-weixin' && process.env.NODE_ENV === 'production'
 
 // https://vitejs.dev/config/
 export default ({ command, mode }) => {
@@ -53,7 +55,7 @@ export default ({ command, mode }) => {
     plugins: [
       UniPages({
         // TODO: 生产环境小程序要过滤掉demo(demo里面很多图片,超过2M的包大小)
-        exclude: isWxProd
+        exclude: hideDemoPages
           ? ['**/components/**/**.*', '**/demo/**/**.*']
           : ['**/components/**/**.*'],
       }),