Docusaurus 3.7
我们很高兴地宣布 Docusaurus 3.7 现已发布。
Docusaurus 现已完全兼容 React 19。
Upgrading should be easy. Our release process respects Semantic Versioning. Minor versions do not include any breaking changes.
精彩内容
React 19
In #10763, we added support for React 19, and the Docusaurus website is running on React 19 already.
From now on, all newly initialized sites will run on React 19 by default, and React 19 will be the minimum required version Docusaurus v4.
However, React 18 remains supported, and existing Docusaurus sites can either choose to stay on React 18, or upgrade their dependencies to React 19:
{
"name": "my-docusaurus-site",
"dependencies": {
- "react": "^18.0.0",
- "react-dom": "^18.0.0"
+ "react": "^19.0.0",
+ "react-dom": "^19.0.0"
}
}
无需立即升级您的网站。
React 19 要比 React 18重一点。 由于我们支持这两种版本,我们还不会对 React19 独有的功能施加影响。
然而,可以升级到 React 19 准备你的 Docusaurus v4 站点,将来可能会逐步减少 React 18 的支持。
以下是在 Docusaurus v4 之前升级您的网站的良好理由:
- You have custom React code and want to ensure it is ready for React19
- 您计划在自己的代码中利用新的 React 19 的特性
- 您使用自定义或第三方插件,并且想要确保它们的兼容性
- You have a monorepo and want to align the React dependency to v19 for all packages
Along the way, we fixed all the remaining hydration errors reported by React 19, some of them produced by our aggressive HTML minifier settings.
SVGR 插件
Docusaurus has built-in support for SVGR, allowing you to seamlessly import and use SVG files as React components:
import DocusaurusSvg from './docusaurus.svg';
<DocusaurusSvg />;
This built-in support has been the source of various bug reports due to the inability to customize the SVGR Options, in particular the SVG Optimizer options.
In #10677, we extracted a new @docusaurus/plugin-svgr
that you can now configure according to your needs. 默认情况下它包含在我们经典预设中:
export default {
presets: [
[
'classic',
{
svgr: {
svgrConfig: {
// 您的 SVGR 选项...
svgoConfig: {
// 您的 SVGO 选项...
// Use "svgoConfig: undefined" to use a svgo.config.js file
},
},
},
},
],
],
};
其他改变:
Other notable changes include:
- #10768: Blog authors have built-in icons for social platforms bluesky, mastodon, threads, twitch, youtube, instagram.
- #10729: Blog now supports
frontMatter.sidebar_label
- #10803:
@docusaurus/remark-plugin-npm2yarn
现在支持 Bun 转换 - #10672:将 Algolia DocSearch 升级到
algoliasearch
v5 - #10800: Docusaurus Faster turns Rspack incremental mode on by default.
- #10783:改进荷兰语的主题翻译
- #10760:改进韩文的主题翻译
查看 3.7.0 changelog entry 以获取更详细的变更列表