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 astro sync config merge #6392

Merged
merged 2 commits into from
Mar 1, 2023
Merged

Fix astro sync config merge #6392

merged 2 commits into from
Mar 1, 2023

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Mar 1, 2023

Changes

Recently merged but unreleased change #6368 regresses #6238. Causing docs to fail to build because integrations that updates the Vite config isn't affecting Astro's internal Vite config.

This PR makes astro sync to run in build mode, meaning plugins with apply: 'serve' will not run in astro sync. I think this is what #6368 was trying to fix (the issue: #6364), so this shouldn't be regressing that. And opens up the path for astro sync to update Astro's internal Vite config.

cc @userquin

Testing

I made sure the test added in #6368 still passed

Docs

n/a. bug fix.

@changeset-bot
Copy link

changeset-bot bot commented Mar 1, 2023

🦋 Changeset detected

Latest commit: acf9e3e

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Mar 1, 2023
Comment on lines -206 to +203
} else {
result = vite.mergeConfig(result, settings.config.vite || {});
}
return true;
});
result = vite.mergeConfig(result, { ...rest, plugins });
} else {
result = vite.mergeConfig(result, settings.config.vite || {});
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main change in this diff is that previously when command is not set, it means it's in astro sync. However, it did not run result = vite.mergeConfig(result, settings.config.vite || {});, causing the issue.

We can't run that mergeConfig if command is undefined because that calls Vite plugins with apply: 'serve' in builds. So I made astro sync run in build mode only to fix this.

@bluwy bluwy added this pull request to the merge queue Mar 1, 2023
Merged via the queue into main with commit ee8b2a0 Mar 1, 2023
@bluwy bluwy deleted the fix-sync-config-merge branch March 1, 2023 15:19
@astrobot-houston astrobot-houston mentioned this pull request Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants