docusaurus

Issues encountered while upgrading from v3.4.0 to v3.5.2


I was trying to upgrade my existing docusaurus project from v3.4.0 to v3.5.2 when I encountered few issues.

  1. When I migrated the packages to v3.5.2 getting errors related to '@theme/Unlisted' Component
Module not found: Error: Can't resolve '@theme/Unlisted' in '/Users/dikshantbansal/dev/developerdocs/src/theme/BlogPostPage'

enter image description here

  1. Updated imports on BlogPostPage and DocItem/Layout. Replaced Unlisted Component with -
import ContentVisibility from '@theme/ContentVisibility';
<ContentVisibility metadata={metadata} />

But still getting error as

ERROR
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

enter image description here

Can someone guide here. Thanks.

Tried docusauras version upgrade from 3.4.0 to 3.5.2


Solution

  • Apparently, I found that there are number of hooks and functions that have been moved from @docusaurus/theme-common/internal to @docusaurus/plugin-content-docs/client and @docusaurus/plugin-content-blog/client.

    Had to go in almost every swizzled component and update the imports. This worked for me!