diff --git a/.changeset/heavy-nails-juggle.md b/.changeset/heavy-nails-juggle.md new file mode 100644 index 000000000..068631f67 --- /dev/null +++ b/.changeset/heavy-nails-juggle.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fix bug where Astro's server runtime would end up in the browser diff --git a/packages/astro/src/vite-plugin-jsx/index.ts b/packages/astro/src/vite-plugin-jsx/index.ts index 3a6f47e86..f8f65743c 100644 --- a/packages/astro/src/vite-plugin-jsx/index.ts +++ b/packages/astro/src/vite-plugin-jsx/index.ts @@ -56,7 +56,10 @@ async function transformJSX({ }: TransformJSXOptions): Promise { const { jsxTransformOptions } = renderer; const options = await jsxTransformOptions!({ mode, ssr }); - const plugins = [...(options.plugins || []), tagExportsPlugin({ rendererName: renderer.name })]; + const plugins = [...(options.plugins || [])]; + if (ssr) { + plugins.push(tagExportsPlugin({ rendererName: renderer.name })) + } const result = await babel.transformAsync(code, { presets: options.presets, plugins,