Packaging custom admonitions and components

17 views Asked by At

I am trying to create a small library of reusable components that build upon existing Docusaurus components such as Details and CodeBlock. Reason being that I have multiple Docusaurus sites that leverage these components and manually updating each is tedious.

The Docusaurus components are added as dependencies but bundling the resources breaks down and I get errors like the following:

ERROR in /Users/me/Develop/docusaurusPackages/workbook-components/node_modules/@docusaurus/theme-classic/src/theme/CodeBlock/index.tsx
./node_modules/@docusaurus/theme-classic/src/theme/CodeBlock/index.tsx 12:25-43
[tsl] ERROR in /Users/me/Develop/docusaurusPackages/workbook-components/node_modules/@docusaurus/theme-classic/src/theme/CodeBlock/index.tsx(12,26)
      TS2307: Cannot find module '@theme/CodeBlock' or its corresponding type declarations.
 @ ./src/theme/Admonition/Type/CommandWithDetails.js 3:0-70 13:110-119
 @ ./src/theme/Admonition/Types.js 2:0-59 14:26-44
 @ ./src/index.js 1:0-55 3:0-42

My build step calls webpack --mode production but it doesn't seem to be resolving the @docusaurus naming that exists within the dependent components. Any guidance here?

0

There are 0 answers