Allow override vite.build.target (#4813)

This commit is contained in:
Bjorn Lu 2022-09-20 20:12:13 +08:00 committed by GitHub
parent 44fa378186
commit be9eaa0692
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Allow override `vite.build.target`

View file

@ -118,6 +118,7 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp
logLevel: opts.viteConfig.logLevel ?? 'error',
mode: 'production',
build: {
target: 'esnext',
...viteConfig.build,
emptyOutDir: false,
manifest: false,
@ -134,8 +135,6 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp
},
},
ssr: true,
// must match an esbuild target
target: 'esnext',
// improve build performance
minify: false,
polyfillModulePreload: false,
@ -197,6 +196,7 @@ async function clientBuild(
logLevel: 'info',
mode: 'production',
build: {
target: 'esnext',
...viteConfig.build,
emptyOutDir: false,
minify: 'esbuild',
@ -213,7 +213,6 @@ async function clientBuild(
},
preserveEntrySignatures: 'exports-only',
},
target: 'esnext', // must match an esbuild target
},
plugins: [
vitePluginInternals(input, internals),