Browser support
Docusaurus allows sites to define the list of supported browsers through a browserslist configuration.
#
PurposeWebsites need to balance between backward compatibility and bundle size. As old browsers do not support modern APIs or syntax, more code is needed to implement the same functionality, penalizing all other users with increased site load time. As a tradeoff, the Docusaurus bundler only supports browser versions defined in the browser list.
The browser list by default is provided through the package.json
file as a root browserslist
field.
caution
On old browsers, the compiled output will use unsupported (too recent) JS syntax, causing React to fail to initialize and ending up with a static website with only HTML/CSS and no JS.
#
Default valuesWebsites initialized with the default classic template has the following in package.json
:
Explained in natural language, the browsers supported in production are those:
- With more than 0.5% of market share; and
- Has official support or updates in the past 24 months (the opposite of "dead"); and
- Is not Opera Mini.
And browsers used in development are:
- The latest version of Chrome or Firefox or Safari.
You can "evaluate" any config with the browserlist
cli to obtain the actual list:
The output are all browsers supported in production. Below is the output in May, 2021:
#
Read moreYou may wish to visit the browserslist documentation for more specifications, especially the accepted query values and best practices.