refactor: use ALWAYS_NOEXTERNAL array
This commit is contained in:
parent
89fa0a5618
commit
f08630bcc4
1 changed files with 8 additions and 1 deletions
|
@ -24,6 +24,13 @@ interface CreateViteOptions {
|
|||
mode: 'dev' | 'build';
|
||||
}
|
||||
|
||||
const ALWAYS_NOEXTERNAL = new Set([
|
||||
// This is only because Vite's native ESM doesn't resolve "exports" correctly.
|
||||
'astro',
|
||||
// Vite fails on nested `.astro` imports without bundling
|
||||
'astro/components',
|
||||
]);
|
||||
|
||||
/** Return a common starting point for all Vite actions */
|
||||
export async function createVite(
|
||||
commandConfig: ViteConfigWithSSR,
|
||||
|
@ -97,7 +104,7 @@ export async function createVite(
|
|||
conditions: ['astro'],
|
||||
},
|
||||
ssr: {
|
||||
noExternal: ['astro', 'astro/components'],
|
||||
noExternal: [...ALWAYS_NOEXTERNAL],
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue