Search code examples
docusaurus

root component swizzle in docusaurus v2 not working


I am trying to wrap my website with a root component: https://docusaurus.io/docs/using-themes#wrapper-your-site-with-root. I made src/theme/Root.js with following code in it:

import React from 'react';

// Default implementation, that you can customize
function Root({children}) {
  console.log('from root');
  return <>{children}</>;
}

export default Root;

Now when I open up the browser console, I don't see any log. What could be the reason? I am using the classic preset with typescript support on


Solution

  • Fixed it by deleting .docusaurus folder and reinstalling the contents of node_modules