fix: Can't overwrite vite's MODE environment variable (#4850)
* Add flags to the build options * replace mode: 'production' as fallback * Update mode support * Add changeset
This commit is contained in:
parent
ee5fdeffdd
commit
edb7bead6e
3 changed files with 8 additions and 3 deletions
5
.changeset/short-ravens-marry.md
Normal file
5
.changeset/short-ravens-marry.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
add support for changing mode via CLI
|
|
@ -239,7 +239,7 @@ async function runCommand(cmd: string, flags: yargs.Arguments) {
|
|||
}
|
||||
|
||||
case 'build': {
|
||||
return await build(settings, { logging, telemetry });
|
||||
return await build(settings, { ...flags, logging, telemetry });
|
||||
}
|
||||
|
||||
case 'check': {
|
||||
|
|
|
@ -115,8 +115,8 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp
|
|||
|
||||
const viteBuildConfig: ViteConfigWithSSR = {
|
||||
...viteConfig,
|
||||
mode: viteConfig.mode || 'production',
|
||||
logLevel: opts.viteConfig.logLevel ?? 'error',
|
||||
mode: 'production',
|
||||
build: {
|
||||
target: 'esnext',
|
||||
...viteConfig.build,
|
||||
|
@ -193,8 +193,8 @@ async function clientBuild(
|
|||
|
||||
const viteBuildConfig = {
|
||||
...viteConfig,
|
||||
mode: viteConfig.mode || 'production',
|
||||
logLevel: 'info',
|
||||
mode: 'production',
|
||||
build: {
|
||||
target: 'esnext',
|
||||
...viteConfig.build,
|
||||
|
|
Loading…
Reference in a new issue