From c0992e1fefc105577e99ac94338d349dbabf38d8 Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Fri, 12 Aug 2022 10:48:53 -0500 Subject: [PATCH] fix(#4194): remove Astro runtime from browser (#4282) Co-authored-by: Nate Moore --- .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 0000000000..068631f67a --- /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 3a6f47e868..f8f65743ce 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,