Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use assetsDir in creating vite config #10732

Merged
merged 14 commits into from
Apr 16, 2024
5 changes: 5 additions & 0 deletions .changeset/afraid-laws-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": minor
---

set build.assets directory during vite config setup
rishi-raj-jain marked this conversation as resolved.
Show resolved Hide resolved
rishi-raj-jain marked this conversation as resolved.
Show resolved Hide resolved
8 changes: 8 additions & 0 deletions packages/astro/src/core/create-vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,14 @@ export async function createVite(
// We also need to filter out the plugins that are not meant to be applied to the current command:
// - If the command is `build`, we filter out the plugins that are meant to be applied for `serve`.
// - If the command is `dev`, we filter out the plugins that are meant to be applied for `build`.
const assetsDir = settings.config.build.assets;
if (assetsDir) {
result = vite.mergeConfig(result, {
build: {
assetsDir,
},
});
}
if (command && settings.config.vite?.plugins) {
let { plugins, ...rest } = settings.config.vite;
const applyToFilter = command === 'build' ? 'serve' : 'build';
Expand Down
Loading