fix: Improve Vite config merging (#1768)

#1755
This commit is contained in:
Drew Powers 2021-11-08 14:43:10 -07:00 committed by GitHub
parent fbae2bc52f
commit fd0e9ce605
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 14 deletions

View file

@ -55,14 +55,16 @@ class AstroBuilder {
const { logging, origin } = this;
const timer: Record<string, number> = { viteStart: performance.now() };
const viteConfig = await createVite(
{
mode: this.mode,
server: {
hmr: { overlay: false },
middlewareMode: 'ssr',
vite.mergeConfig(
{
mode: this.mode,
server: {
hmr: { overlay: false },
middlewareMode: 'ssr',
},
},
...(this.config.vite || {}),
},
this.config.vite || {}
),
{ astroConfig: this.config, logging }
);
const viteServer = await vite.createServer(viteConfig);

View file

@ -222,14 +222,16 @@ export class AstroDevServer {
private async createViteServer() {
const viteConfig = await createVite(
{
mode: 'development',
server: {
middlewareMode: 'ssr',
host: this.hostname,
vite.mergeConfig(
{
mode: 'development',
server: {
middlewareMode: 'ssr',
host: this.hostname,
},
},
...(this.config.vite || {}),
},
this.config.vite || {}
),
{ astroConfig: this.config, logging: this.logging, devServer: this }
);
const viteServer = await vite.createServer(viteConfig);