From b6dddba29263ad2bbd933acd308dd5bfeb2a2085 Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Thu, 11 Aug 2022 22:51:35 -0500 Subject: [PATCH] fix(#4194): remove Astro runtime from browser --- .changeset/heavy-nails-juggle.md | 5 +++++ packages/astro/src/vite-plugin-jsx/index.ts | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/heavy-nails-juggle.md diff --git a/.changeset/heavy-nails-juggle.md b/.changeset/heavy-nails-juggle.md new file mode 100644 index 000000000000..068631f67a24 --- /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 3a6f47e868b5..f8f65743ce9b 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,