diff --git a/packages/docusaurus/src/commands/swizzle.ts b/packages/docusaurus/src/commands/swizzle.ts index 7f04a7f4e9..49b1bd7195 100644 --- a/packages/docusaurus/src/commands/swizzle.ts +++ b/packages/docusaurus/src/commands/swizzle.ts @@ -50,8 +50,8 @@ export function getPluginNames(plugins: PluginConfig[]): string[] { const formatComponentName = (componentName: string): string => componentName - .replace(/(\/|\\)index.(js|tsx|ts|jsx)/, '') - .replace(/.(js|tsx|ts|jsx)/, ''); + .replace(/(\/|\\)index\.(js|tsx|ts|jsx)/, '') + .replace(/\.(js|tsx|ts|jsx)/, ''); function readComponent(themePath: string) { function walk(dir: string): Array {