跳到主要内容

📦 plugin-debug

The debug plugin will display useful debug information at http://localhost:3000/__docusaurus/debug.

这对于插件开发者最有用,它能帮开发者轻松检查 .docusaurus 文件夹中的内容(例如创建的路由),而且还能够检查从不写到硬盘上的数据,例如插件通过 contentLoaded 生命周期函数所加载的数据。

信息

If you use the plugin via the classic preset, the preset will enable the plugin in development and disable it in production by default (debug: undefined) to avoid exposing potentially sensitive information. You can use debug: true to always enable it or debug: false to always disable it.

If you use a standalone plugin, you may need to achieve the same effect by checking the environment:

docusaurus.config.js
module.exports = {
plugins: [
process.env.NODE_ENV === 'production' && '@docusaurus/plugin-debug',
].filter(Boolean),
};
备注

如果你想我们报告了一个 bug,我们可能会要求你在生成环境中开启此插件,以便我们可以轻松地检查你的部署配置情况来定位问题所在。

If you don't have any sensitive information, you can keep it on in production like we do.

安装

npm install --save @docusaurus/plugin-debug
提示

If you use the preset @docusaurus/preset-classic, you don't need to install this plugin as a dependency.

You can configure this plugin through the preset options.

配置

This plugin currently has no options.

Example configuration

You can configure this plugin through preset options or plugin options.

提示

Most Docusaurus users configure this plugin through the preset options.

If you use a preset, configure this plugin through the preset options:

docusaurus.config.js
module.exports = {
presets: [
[
'@docusaurus/preset-classic',
{
debug: true, // This will enable the plugin in production
},
],
],
};