-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Call to updateConfig is ignored in astro:build:setup
hook
#12372
Comments
I believe the documentation isn't correct. In fact, |
In this case, the type signature 'astro:build:setup': (options: {
vite: vite.InlineConfig;
pages: Map<string, PageBuildData>;
target: 'client' | 'server';
updateConfig: (newConfig: vite.InlineConfig) => void;
logger: AstroIntegrationLogger;
}) => void | Promise<void>; should be adjusted as well. Currently, the function |
Via @Fryuni in discord
|
I have this error with the newst version of both packages, astrojs 4.16.10 and @astrobot/db 0.14.3; but with the astrojs 4.16.9 works Here a pick:
[astro] Unable to load your Astro config |
As @felixhuttmann mentioned, the The configuration passed to the |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
When writing an integration using the
astro:build:setup
hook, the call toupdateConfig
has no effect. For example, the below code, does not result in a build error:In contrast, modifying the config in the
astro:config:setup
hook works correctly, so that the following code will result in a build error:The documentation https://docs.astro.build/en/reference/integrations-reference/#astrobuildsetup states that the vite config should be modifiable also in the
astro:build:setup
hook. However, using theastro:config:setup
hook is not an option for us, because thetarget: 'client' | 'server'
parameter is available only in theastro:build:setup
hook.We need this feature because we want to set the esbuild target to
safari12
only for the client, but not for the server. This is necessary because we need old browser compatibility on the client (thus "safari12), while on the server, the astrojs/node adapter started to use top-level await recently (https://github.com/withastro/adapters/blob/b0b247e5cd2fce02136e1998b26e893f02326fff/packages/node/src/server.ts#L12) which esbuild cannot transform. Before astrojs/node started to require top-level await, it was possible to use theastro:config:setup
hook to transform all code to thesafari12
target, which (together with some polyfills) allows us to run astro productively while still supporting safari 12. Because we need old browser compat, we are currently stuck on @astrojs/node 8.2.5 and astro 4.8.3.A previous discussion on discord is at https://discord.com/channels/830184174198718474/872579324446928896/1303043016717762570.
What's the expected result?
updateConfig
call is not ignored.Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-7wdm2j?file=astro.config.mjs
Participation
The text was updated successfully, but these errors were encountered: