You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, several changes in alpha-62 makes it much harder in two possible scenarios of blog-only mode usage:
alpha-62 will start complain and abort when docs folder or sidebars.json is missing. This means that if we are using preset-classic and have no docs, build cannot succeed. The workaround might be add some dummy docs.
alpha-62 introduces some hooks from docs plugin. If we don't use preset-classic and only use blog plugin and theme-classic, build will fail because @theme/hooks only exist in docs plugin but some components in theme-classic import it:
yarn start. It failed. See Actual Behavior section below.
Expected behavior
Blog only mode should work out-of-the-box.
Actual Behavior
Scenario 1: (with preset-classic)
module.exports={// ...presets: [['@docusaurus/preset-classic',{blog: {path: './blog',routeBasePath: '/',// Set this value to '/'.},theme: {customCss: require.resolve('./src/css/custom.css'),},},],],};
➜ test yarn start
yarn run v1.22.5
$ docusaurus start
Starting the development server...
Error: The docs folder does not exist for version [current]. A docs folder is expected to be found at /Users/sam/Downloads/test/docs
at checkVersionMetadataPaths (/Users/sam/Downloads/test/node_modules/@docusaurus/plugin-content-docs/lib/versions.js:132:15)
at Array.forEach (<anonymous>)
at Object.readVersionsMetadata (/Users/sam/Downloads/test/node_modules/@docusaurus/plugin-content-docs/lib/versions.js:171:22)
at pluginContentDocs (/Users/sam/Downloads/test/node_modules/@docusaurus/plugin-content-docs/lib/index.js:27:41)
at /Users/sam/Downloads/test/node_modules/@docusaurus/core/lib/server/plugins/init.js:72:48
at Array.map (<anonymous>)
at Object.initPlugins [as default] (/Users/sam/Downloads/test/node_modules/@docusaurus/core/lib/server/plugins/init.js:27:10)
at Object.loadPlugins (/Users/sam/Downloads/test/node_modules/@docusaurus/core/lib/server/plugins/index.js:49:35)
at Object.load (/Users/sam/Downloads/test/node_modules/@docusaurus/core/lib/server/index.js:78:74)
at start (/Users/sam/Downloads/test/node_modules/@docusaurus/core/lib/commands/start.js:44:34)
at /Users/sam/Downloads/test/node_modules/@docusaurus/core/bin/docusaurus.js:73:5
at Command.<anonymous> (/Users/sam/Downloads/test/node_modules/@docusaurus/core/bin/docusaurus.js:152:23)
at Command.listener (/Users/sam/Downloads/test/node_modules/commander/index.js:370:29)
at Command.emit (events.js:315:20)
at Command.parseArgs (/Users/sam/Downloads/test/node_modules/commander/index.js:892:12)
at Command.parse (/Users/sam/Downloads/test/node_modules/commander/index.js:642:21)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
module.exports={// ...themes: [[require.resolve('@docusaurus/theme-classic'),{customCss: require.resolve('./src/css/custom.css')},],],plugins: [[require.resolve('@docusaurus/plugin-content-blog'),{path: './blog',routeBasePath: '/',// Set this value to '/'.},],],};
./node_modules/@docusaurus/theme-classic/lib/theme/NavbarItem/DocsVersionNavbarItem.js
Module not found: Can't resolve '@theme/hooks/useDocs' in '/Users/sam/Downloads/test/node_modules/@docusaurus/theme-classic/lib/theme/NavbarItem'
Your Environment
Docusaurus version used: v2-alpha-62
Environment name and version (e.g. Chrome 78.0.3904.108, Node.js 10.17.0): Node.js 12
Operating system and version (desktop or mobile): desktop
The text was updated successfully, but these errors were encountered:
)
* deprecated nextVersionLabel option
* useActivePlugin failfast option
* remove deprecated option nextVersionLabel
* routeBasePath: '' should be forbidden
* routeBasePath: '' should be forbidden
* Docs: do not show version badge if there is only 1 version: #3362
* allow sidebars file to not exist: fallback to empty sidebars
https://githu.com/facebook/docusaurus/issues/3366
* Ability to use classic theme/preset while not using docs/pages without trouble.
#3360
* fix netlify redirects
* do not throw if useDocs do not load?
* netlify deploy typo
* try to fix useDocs
* docs(v2): update Deploy to Vercel guide (#3344)
* filter annoying useDocs conditional require warning
* netlify deploy preview homepage
* typo
* try to trigger again CLA bot
Co-authored-by: Sam Ko <sam@vercel.com>
🐛 Bug Report
In the documentation, it mentions that preset classic can support blog-only mode seamlessly: https://v2.docusaurus.io/docs/blog#blog-only-mode
However, several changes in alpha-62 makes it much harder in two possible scenarios of blog-only mode usage:
alpha-62 will start complain and abort when docs folder or
sidebars.json
is missing. This means that if we are using preset-classic and have no docs, build cannot succeed. The workaround might be add some dummy docs.alpha-62 introduces some hooks from docs plugin. If we don't use preset-classic and only use blog plugin and theme-classic, build will fail because
@theme/hooks
only exist in docs plugin but some components in theme-classic import it:docusaurus/packages/docusaurus-theme-classic/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx
Lines 10 to 14 in 4f448bd
To workaround the issue, I created a dummy
useDocs.js
insrc/theme/hooks
in my website:https://github.com/SamChou19815/website/blob/e5899283386065581a3a37df9e816e9bf82e2ae8/packages/blog/src/theme/hooks/useDocs.js
but ideally blog-only mode can just work without this kind of hacks.
Have you read the Contributing Guidelines on issues?
Yes
To Reproduce
(Write your steps here:)
npx @docusaurus/init@next init test classic
yarn start
. It failed. SeeActual Behavior
section below.Expected behavior
Blog only mode should work out-of-the-box.
Actual Behavior
Scenario 1: (with preset-classic)
Scenario 2: (with
@docusaurus/theme-classic
+@docusaurus/plugin-content-blog
)Your Environment
The text was updated successfully, but these errors were encountered: