diff --git a/packages/astro/src/core/build/plugins/plugin-renderers.ts b/packages/astro/src/core/build/plugins/plugin-renderers.ts index 912df42418f0..f0cdf898331b 100644 --- a/packages/astro/src/core/build/plugins/plugin-renderers.ts +++ b/packages/astro/src/core/build/plugins/plugin-renderers.ts @@ -38,6 +38,8 @@ export function vitePluginRenderers(opts: StaticBuildOptions): VitePlugin { exports.push(`export const renderers = [${rendererItems}];`); return `${imports.join('\n')}\n${exports.join('\n')}`; + } else { + return `export const renderers = [];`; } } }, diff --git a/packages/integrations/mdx/src/index.ts b/packages/integrations/mdx/src/index.ts index ecf2a9a95950..4cce2392128a 100644 --- a/packages/integrations/mdx/src/index.ts +++ b/packages/integrations/mdx/src/index.ts @@ -13,6 +13,7 @@ import type { Plugin as VitePlugin } from 'vite'; import { getRehypePlugins, getRemarkPlugins, recmaInjectImportMetaEnvPlugin } from './plugins.js'; import type { OptimizeOptions } from './rehype-optimize-static.js'; import { getFileInfo, ignoreStringPlugins, parseFrontmatter } from './utils.js'; +import astroJSXRenderer from 'astro/jsx/renderer.js'; export type MdxOptions = Omit & { extendMarkdownConfig: boolean; @@ -37,9 +38,10 @@ export default function mdx(partialMdxOptions: Partial = {}): AstroI name: '@astrojs/mdx', hooks: { 'astro:config:setup': async (params) => { - const { updateConfig, config, addPageExtension, addContentEntryType, command } = + const { updateConfig, config, addPageExtension, addContentEntryType, command, addRenderer } = params as SetupHookParams; + addRenderer(astroJSXRenderer); addPageExtension('.mdx'); addContentEntryType({ extensions: ['.mdx'],