What is the significance of browserslist in package.json created by create-react-app

蹲街弑〆低调 提交于 2020-06-10 07:59:49

问题


I was asked this in an interview. I could not answer.

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

I can see that Its an array. "not ie <=11" means will not run on lower than Internet Explorer v11 "op_mini" must be related to Opera mini.

But I want to know why it is required.


回答1:


That's a React configuration option to know which browsers the build process should target to.

As the documentation says:

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

If you are intend to use a ES feature make sure all browsers specified supports it, otherwise you have to include polyfills manually. React will not do it for you automatically.

See more in: https://facebook.github.io/create-react-app/docs/supported-browsers-features



来源:https://stackoverflow.com/questions/55510405/what-is-the-significance-of-browserslist-in-package-json-created-by-create-react

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!