API 浏览器
Quasar CLI with Webpack - @quasar/app-webpack
浏览器兼容性

配置兼容性(Configuring compatibility)

¥Configuring compatibility

你的 /package.json 文件应该包含一个 browserslist 字段。这将告诉 Quasar 应用该项目所针对的浏览器范围。Babel 和 Autoprefixer 将使用此字段来确定如何转译 JS 代码(如果转译功能保持启用状态)以及添加 CSS 代码所需的 CSS 供应商前缀。

¥Your /package.json file should contain a browserslist field. This will tell Quasar App the range of browsers that the project is targeting. Babel and Autoprefixer will use this field to determine how to transpile JS code (if transpiling is left enabled) and what CSS vendor prefixes it needs to add your CSS code.

Babel 将根据配置的浏览器准确查找需要转译的 JS 特性并应用它们。不过要小心,因为只需在选项列表中添加一个 “错误苹果” 即可,这会将你的代码简化回 ES5。

¥Babel will look for exactly the JS features that need transpiling (based on the configured browsers) and apply them. Be mindful about it though, as it is sufficient to add one “bad apple” in the options list and that will dumb down your code back to ES5.

以下是创建 Quasar 项目时默认的 “browserslist”:

¥The following is the default “browserslist” when you create a Quasar project:

package.json

"browserslist": [
  "last 10 Chrome versions",
  "last 10 Firefox versions",
  "last 4 Edge versions",
  "last 7 Safari versions",
  "last 8 Android versions",
  "last 8 ChromeAndroid versions",
  "last 8 FirefoxAndroid versions",
  "last 10 iOS versions",
  "last 5 Opera versions"
]

更多关于如何指定浏览器范围的信息:browserslist

¥More info on how to specify browser ranges: browserslist.