From 34317bc05c707179af0be6c9fe743c1fd1299532 Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Fri, 11 Feb 2022 16:22:16 -0500 Subject: [PATCH] Use noExternal config on 'astro' (#2570) * Use noExternal config on 'astro' * Changeset --- .changeset/soft-mayflies-warn.md | 5 +++++ packages/astro/src/core/create-vite.ts | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/soft-mayflies-warn.md diff --git a/.changeset/soft-mayflies-warn.md b/.changeset/soft-mayflies-warn.md new file mode 100644 index 000000000..0031f6b46 --- /dev/null +++ b/.changeset/soft-mayflies-warn.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes bug with astro/components not loading in the next release diff --git a/packages/astro/src/core/create-vite.ts b/packages/astro/src/core/create-vite.ts index 76f1c11b5..d7aaec990 100644 --- a/packages/astro/src/core/create-vite.ts +++ b/packages/astro/src/core/create-vite.ts @@ -25,6 +25,9 @@ const ALWAYS_EXTERNAL = new Set([ 'unified', 'whatwg-url', ]); +const ALWAYS_NOEXTERNAL = new Set([ + 'astro', // This is only because Vite's native ESM doesn't resolve "exports" correctly. +]); // note: ssr is still an experimental API hence the type omission export type ViteConfigWithSSR = vite.InlineConfig & { ssr?: { external?: string[]; noExternal?: string[] } }; @@ -69,7 +72,7 @@ export async function createVite(inlineConfig: ViteConfigWithSSR, { astroConfig, // Note: SSR API is in beta (https://vitejs.dev/guide/ssr.html) ssr: { external: [...ALWAYS_EXTERNAL], - noExternal: [], + noExternal: [...ALWAYS_NOEXTERNAL], }, };