mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
Support envPrefix in Astro config (#5852)
* Support envPrefix in Astro config * Update packages/astro/src/core/config/schema.ts Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com> * Update packages/astro/src/core/build/static-build.ts Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com> * Update packages/astro/src/core/build/static-build.ts Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com> * Update packages/astro/src/core/config/schema.ts Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com> * Update packages/astro/src/core/create-vite.ts Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com> * Update .changeset/twenty-llamas-type.md Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
This commit is contained in:
parent
ca22a81799
commit
3a00ecb3eb
3 changed files with 8 additions and 3 deletions
5
.changeset/twenty-llamas-type.md
Normal file
5
.changeset/twenty-llamas-type.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Respect `vite.envPrefix` if provided
|
|
@ -161,7 +161,7 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp
|
|||
// SSR needs to be last
|
||||
ssr && vitePluginSSR(internals, settings.adapter!),
|
||||
],
|
||||
envPrefix: 'PUBLIC_',
|
||||
envPrefix: viteConfig.envPrefix ?? 'PUBLIC_',
|
||||
base: settings.config.base,
|
||||
};
|
||||
|
||||
|
@ -230,7 +230,7 @@ async function clientBuild(
|
|||
}),
|
||||
...(viteConfig.plugins || []),
|
||||
],
|
||||
envPrefix: 'PUBLIC_',
|
||||
envPrefix: viteConfig.envPrefix ?? 'PUBLIC_',
|
||||
base: settings.config.base,
|
||||
};
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ export async function createVite(
|
|||
],
|
||||
publicDir: fileURLToPath(settings.config.publicDir),
|
||||
root: fileURLToPath(settings.config.root),
|
||||
envPrefix: 'PUBLIC_',
|
||||
envPrefix: settings.config.vite?.envPrefix ?? 'PUBLIC_',
|
||||
define: {
|
||||
'import.meta.env.SITE': settings.config.site
|
||||
? JSON.stringify(settings.config.site)
|
||||
|
|
Loading…
Reference in a new issue