From 9a1d41c530687750085f768e68adeebba556d81b Mon Sep 17 00:00:00 2001 From: Zwyx <29386932+Zwyx@users.noreply.github.com> Date: Wed, 4 Oct 2023 21:11:08 +0800 Subject: [PATCH] fix(mdx-loader): use `inlineMarkdownAssetFileLoader` for to prevent pages' thumbnails from being inserted into the page as base64 data --- packages/docusaurus-mdx-loader/src/loader.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/docusaurus-mdx-loader/src/loader.ts b/packages/docusaurus-mdx-loader/src/loader.ts index 7b428646c74c..328d2f60015b 100644 --- a/packages/docusaurus-mdx-loader/src/loader.ts +++ b/packages/docusaurus-mdx-loader/src/loader.ts @@ -28,7 +28,7 @@ import type {LoaderContext} from 'webpack'; type Pluggable = any; // TODO fix this asap const { - loaders: {inlineMarkdownImageFileLoader}, + loaders: {inlineMarkdownAssetFileLoader}, } = getFileLoaderUtils(); export type MDXPlugin = Pluggable; @@ -92,7 +92,7 @@ function createAssetsExportCode(assets: unknown) { if (typeof assetValue === 'string' && assetValue.startsWith('./')) { // TODO do we have other use-cases than image assets? // Probably not worth adding more support, as we want to move to Webpack 5 new asset system (https://github.com/facebook/docusaurus/pull/4708) - const inlineLoader = inlineMarkdownImageFileLoader; + const inlineLoader = inlineMarkdownAssetFileLoader; return `require("${inlineLoader}${escapePath(assetValue)}").default`; } return undefined;