yulimchen / vue3-h5-template

🌱 A ready-to-use mobile project base template built with the Vue3, Vant, and Vite. | 基于 Vue3、Vite5、TypeScript/JavaScript、Tailwindcss、Vant4,开箱即用的移动端项目基础模板
https://yulimchen.github.io/vue3-h5-template/
MIT License
1.06k stars 255 forks source link

浏览器低版本不支持?./??空安全语法糖 #72

Closed SheepYang1993 closed 2 months ago

SheepYang1993 commented 2 months ago

Android System WebView版本:57.0.2987.132 型号:Redmi4 Rom版本:MIUI10.9.3.28开发版 Android版本:6.0.1 image

SheepYang1993 commented 2 months ago

看了下日志,好像是不支持?. ??这种写法

yulimchen commented 2 months ago

浏览器版本过于老旧,需参考 https://cn.vitejs.dev/guide/build#browser-compatibility 做兼容处理

SheepYang1993 commented 2 months ago

加了这个配置还是不行

    build: {
      target: ['es2015','es2020'],
      minify: 'terser',
      terserOptions: {
        compress: {
          //  生产环境时移除console
          drop_console: true,
          drop_debugger: true,
        }
      },
    }
yulimchen commented 2 months ago

文档里提到结合 @vitejs/plugin-legacy 插件做 polyfill 处理,可以尝试下。

SheepYang1993 commented 2 months ago

已解决