Skip to content

Commit

Permalink
Use noExternal config on 'astro' (#2570)
Browse files Browse the repository at this point in the history
* Use noExternal config on 'astro'

* Changeset
  • Loading branch information
matthewp committed Feb 11, 2022
1 parent ba54e01 commit 34317bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/soft-mayflies-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes bug with astro/components not loading in the next release
5 changes: 4 additions & 1 deletion packages/astro/src/core/create-vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] } };
Expand Down Expand Up @@ -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],
},
};

Expand Down

0 comments on commit 34317bc

Please sign in to comment.