Conversation
|
I would find this useful for Nuxt. We currently 'grab' the resolved nuxt client side configuration for use in our vitest environment (and storybook does the same). In migrating to the vite environment API, we're missing a similar |
| environmentConfigResolved?: ( | ||
| environment: PartialEnvironment, | ||
| ) => boolean | Promise<boolean> | PluginOption |
There was a problem hiding this comment.
Type signature mismatch: The hook definition allows returning boolean | Promise<boolean> | PluginOption, but the implementation in config.ts (lines 2196-2198) calls the handler without handling return values. This creates a semantic mismatch where plugins might expect their return values to be processed (especially PluginOption which suggests plugin registration), but the implementation ignores all return values. Either change the return type to void | Promise<void> to match the implementation, or modify the implementation to handle the return values appropriately.
| environmentConfigResolved?: ( | |
| environment: PartialEnvironment, | |
| ) => boolean | Promise<boolean> | PluginOption | |
| environmentConfigResolved?: ( | |
| environment: PartialEnvironment, | |
| ) => void | Promise<void> |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
Description
After #20170, there isn't an easy way to get the resolved plugins for each environment before the post-config stage kicks in.
This PR introduces an experimental
environmentConfigResolvedhook that is called for each environment. Theenvironment.config.pluginsfor each environment get called, meaning that plugins returned inapplyToEnvironmentwould also participate (and that if a plugin was removed for an environment, theirenvironmentConfigResolvedwill not be called for that environment).