0.2%", "not dead", "not ie <= 11", "not op_mini all" ] 我可以-6ren">
gpt4 book ai didi

create-react-app - create-react-app创建的package.json中browserslist的意义是什么

转载 作者:行者123 更新时间:2023-12-04 07:48:27 24 4
gpt4 key购买 nike

我在一次采访中被问到这个问题。我无法回答。

"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]

我可以看到它是一个数组。
“not ie <=11”表示不会在低于 Internet Explorer v11 的版本上运行
“op_mini”必须与 Opera mini 相关。

但我想知道为什么需要它。

最佳答案

这是一个 React 配置选项,用于了解构建过程应该针对哪些浏览器。
正如文档所说:

The browserslist configuration controls the outputted JavaScript so that the emitted code will be compatible with the browsers specified.


如果您打算使用 ES 功能,请确保所有指定的浏览器都支持它,否则您必须手动包含 polyfill。 React 不会自动为你做这件事。
查看更多: https://facebook.github.io/create-react-app/docs/supported-browsers-featureshttps://create-react-app.dev/docs/supported-browsers-features/

关于create-react-app - create-react-app创建的package.json中browserslist的意义是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55510405/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com