From e9f3537696d48d7eeff64c9cb5b26ecdd28c9b69 Mon Sep 17 00:00:00 2001 From: sebastienlorber Date: Fri, 12 May 2023 15:47:47 +0200 Subject: [PATCH] Remove useless js loader --- packages/docusaurus-plugin-content-blog/src/index.ts | 3 +-- packages/docusaurus-plugin-content-docs/src/index.ts | 2 -- packages/docusaurus-plugin-content-pages/src/index.ts | 3 +-- packages/docusaurus/src/server/plugins/synthetic.ts | 3 +-- website/src/plugins/changelog/index.js | 3 ++- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/docusaurus-plugin-content-blog/src/index.ts b/packages/docusaurus-plugin-content-blog/src/index.ts index a86b835e0556..d5ca869b4a1d 100644 --- a/packages/docusaurus-plugin-content-blog/src/index.ts +++ b/packages/docusaurus-plugin-content-blog/src/index.ts @@ -359,7 +359,7 @@ export default async function pluginContentBlog( return translateContent(content, translationFiles); }, - configureWebpack(_config, isServer, {getJSLoader}, content) { + configureWebpack(_config, isServer, utils, content) { const { admonitions, rehypePlugins, @@ -399,7 +399,6 @@ export default async function pluginContentBlog( // Trailing slash is important, see https://github.com/facebook/docusaurus/pull/3970 .map(addTrailingPathSeparator), use: [ - getJSLoader({isServer}), { loader: require.resolve('@docusaurus/mdx-loader'), options: { diff --git a/packages/docusaurus-plugin-content-docs/src/index.ts b/packages/docusaurus-plugin-content-docs/src/index.ts index 189168177457..9cd4e2eed587 100644 --- a/packages/docusaurus-plugin-content-docs/src/index.ts +++ b/packages/docusaurus-plugin-content-docs/src/index.ts @@ -228,7 +228,6 @@ export default async function pluginContentDocs( }, configureWebpack(_config, isServer, utils, content) { - const {getJSLoader} = utils; const { rehypePlugins, remarkPlugins, @@ -263,7 +262,6 @@ export default async function pluginContentDocs( test: /\.mdx?$/i, include: contentDirs, use: [ - getJSLoader({isServer}), { loader: require.resolve('@docusaurus/mdx-loader'), options: { diff --git a/packages/docusaurus-plugin-content-pages/src/index.ts b/packages/docusaurus-plugin-content-pages/src/index.ts index ab1b3c70ccf3..f65cd49a1815 100644 --- a/packages/docusaurus-plugin-content-pages/src/index.ts +++ b/packages/docusaurus-plugin-content-pages/src/index.ts @@ -186,7 +186,7 @@ export default function pluginContentPages( ); }, - configureWebpack(config, isServer, {getJSLoader}) { + configureWebpack() { const { admonitions, rehypePlugins, @@ -209,7 +209,6 @@ export default function pluginContentPages( // Trailing slash is important, see https://github.com/facebook/docusaurus/pull/3970 .map(addTrailingPathSeparator), use: [ - getJSLoader({isServer}), { loader: require.resolve('@docusaurus/mdx-loader'), options: { diff --git a/packages/docusaurus/src/server/plugins/synthetic.ts b/packages/docusaurus/src/server/plugins/synthetic.ts index 36a2d09f4bce..6a5a527917f7 100644 --- a/packages/docusaurus/src/server/plugins/synthetic.ts +++ b/packages/docusaurus/src/server/plugins/synthetic.ts @@ -85,7 +85,7 @@ export function createMDXFallbackPlugin({ version: {type: 'synthetic'}, // Synthetic, the path doesn't matter much path: '.', - configureWebpack(config, isServer, {getJSLoader}) { + configureWebpack(config) { // We need the mdx fallback loader to exclude files that were already // processed by content plugins mdx loaders. This works, but a bit // hacky... Not sure there's a way to handle that differently in webpack @@ -117,7 +117,6 @@ export function createMDXFallbackPlugin({ test: /\.mdx?$/i, exclude: getMDXFallbackExcludedPaths(), use: [ - getJSLoader({isServer}), { loader: require.resolve('@docusaurus/mdx-loader'), options: mdxLoaderOptions, diff --git a/website/src/plugins/changelog/index.js b/website/src/plugins/changelog/index.js index c0b294fc1186..760e0760a4eb 100644 --- a/website/src/plugins/changelog/index.js +++ b/website/src/plugins/changelog/index.js @@ -138,7 +138,8 @@ async function ChangelogPlugin(context, options) { 'default', ); // Redirect the metadata path to our folder - config.module.rules[0].use[1].options.metadataPath = (mdxPath) => { + const mdxLoader = config.module.rules[0].use[0]; + mdxLoader.options.metadataPath = (mdxPath) => { // Note that metadataPath must be the same/in-sync as // the path from createData for each MDX. const aliasedPath = aliasedSitePath(mdxPath, context.siteDir);