Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
slorber committed May 24, 2024
1 parent 43ab19b commit 98e393f
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions packages/docusaurus-plugin-content-docs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@ export default async function pluginContentDocs(
beforeDefaultRemarkPlugins,
} = options;

const contentDirs = versionsMetadata
.flatMap(getContentPathList)
// Trailing slash is important, see https://github.com/facebook/docusaurus/pull/3970
.map(addTrailingPathSeparator);

// TODO this does not re-run when content gets updated in dev!
// it's probably better to restore a mutable cache in the plugin
function getSourceToPermalink(): SourceToPermalink {
Expand All @@ -263,11 +268,6 @@ export default async function pluginContentDocs(
const sourceToPermalink = getSourceToPermalink();

function createMDXLoader(): RuleSetUseItem {
const contentDirs = versionsMetadata
.flatMap(getContentPathList)
// Trailing slash is important, see https://github.com/facebook/docusaurus/pull/3970
.map(addTrailingPathSeparator);

const loaderOptions: MDXLoaderOptions = {
admonitions: options.admonitions,
remarkPlugins,
Expand Down Expand Up @@ -315,14 +315,8 @@ export default async function pluginContentDocs(
};

return {
test: /\.mdx?$/i,
include: contentDirs,
use: [
{
loader: require.resolve('@docusaurus/mdx-loader'),
options: loaderOptions,
},
].filter(Boolean),
loader: require.resolve('@docusaurus/mdx-loader'),
options: loaderOptions,
};
}

Expand All @@ -339,7 +333,13 @@ export default async function pluginContentDocs(
},
},
module: {
rules: [createMDXLoader()],
rules: [
{
test: /\.mdx?$/i,
include: contentDirs,
use: [createMDXLoader()],
},
],
},
};
},
Expand Down

0 comments on commit 98e393f

Please sign in to comment.