首页 > 解决方案 > 我的 Vue webapp 的 browserslistrc 应该是什么样子才能支持非常旧的 Safari 版本?

问题描述

我有一台运行 iOS 5 的旧 iPad gen 1,我想让我的 Vue webapp(使用 Vue CLI 创建)运行。因此我决定将我browserslistrc的更新为以下以支持旧版本的 Safari 浏览器:

> 1%
last 2 versions
not dead
ios_saf 5.1
ios_saf 5.0
safari 5.1
safari 5.0

我的npm build命令如下:vue-cli-service-build --modern

现在,当我运行npm run build代码并将代码部署到我的服务器时,当我在 iPad (safari) 上访问服务器时,不会显示 web 应用程序。不过,该 web 应用程序在现代浏览器上是可见的。

我也尝试last 20 versions过我browserslistrc的,甚至包括 safari 5.0 之前的版本(运行时npx browserslist)。不幸的是,该网络应用程序仍然无法在我的 iPad 上运行。

我错过了什么吗?我已关注https://cli.vuejs.org/guide/browser-compatibility.html,但我无法让 webapp 在我的 iPad 上运行。

我的package.json

{
  "name": "frontend",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "axios": "^0.20.0",
    "core-js": "^3.6.5",
    "sass": "^1.27.0",
    "sass-loader": "^10.0.3",
    "vue": "^2.6.11",
    "vue-axios": "^2.1.5",
    "vue-device-detector": "^1.1.6",
    "vue-material": "^1.0.0-beta-15",
    "vue-router": "^3.2.0",
    "vuelidate": "^0.7.5"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^6.2.2",
    "vue-template-compiler": "^2.6.11"
  }
}

我的babel.config.js

module.exports = {
  presets: [
    '@vue/cli-plugin-babel/preset'
  ]
}

标签: vue.jsnpm

解决方案


推荐阅读