mirror of
https://github.com/facebook/docusaurus.git
synced 2025-12-29 05:12:52 +00:00
fix(v2): fix navbar items issue on Windows? (#3922)
* attempt to fix navbar items issue on Windows? * attempt to fix alias ordering issue on Windows
This commit is contained in:
parent
b79568fff9
commit
6703f8420e
|
|
@ -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,
|
||||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue