Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(v2): fix navbar items issue on Windows? #3922

Merged
merged 2 commits into from
Dec 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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