Skip to content

Commit

Permalink
fix(v2): fix navbar items issue on Windows? (#3922)
Browse files Browse the repository at this point in the history
* attempt to fix navbar items issue on Windows?

* attempt to fix alias ordering issue on Windows
  • Loading branch information
slorber authored Dec 14, 2020
1 parent b79568f commit 6703f84
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/docusaurus/src/server/themes/alias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import fs from 'fs-extra';
import path from 'path';
import {fileToPath, posixPath, normalizeUrl} from '@docusaurus/utils';
import {ThemeAlias} from '@docusaurus/types';
import {sortBy} from 'lodash';

export default function themeAlias(
themePath: string,
Expand All @@ -23,9 +24,15 @@ export default function themeAlias(
cwd: themePath,
});

// See https://github.com/facebook/docusaurus/pull/3922
// ensure @theme/NavbarItem alias is created after @theme/NavbarItem/LocaleDropdown
const sortedThemeComponentFiles = sortBy(themeComponentFiles, (file) =>
file.endsWith('/index.js'),
);

const aliases: ThemeAlias = {};

themeComponentFiles.forEach((relativeSource) => {
sortedThemeComponentFiles.forEach((relativeSource) => {
const filePath = path.join(themePath, relativeSource);
const fileName = fileToPath(relativeSource);

Expand Down

0 comments on commit 6703f84

Please sign in to comment.