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

后端 未结 1 921
陌清茗
陌清茗 2021-02-03 22:16

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

\"browserslist\": [
\">0.2%\",
\"not dead\",
\"not ie <= 11\",
\"not op_mini all\"
]
<
1条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-03 22:48

    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 and https://create-react-app.dev/docs/supported-browsers-features/

    0 讨论(0)
提交回复
热议问题