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

test(v6): reproduce custom environment preload injection #16541

Merged

Conversation

hi-ogawa
Copy link
Collaborator

@hi-ogawa hi-ogawa commented Apr 27, 2024

Description

@patak-dev I tested alpha.5 in hi-ogawa/vite-environment-examples#51 and it looks like __vitePreload is now injected for custom environment with ssr: true, which wasn't the case in alpha.3.

For now I added a failing test here as you might notice something. I start to read the new builder code, so I might going to find something myself.

It looks like per-environment resolveConfigToBuild is not including environmentOptions from the root config:

environmentConfig = await resolveConfigToBuild(inlineConfig, patchConfig)

Copy link

stackblitz bot commented Apr 27, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@patak-dev
Copy link
Member

patak-dev commented Apr 28, 2024

Thanks @hi-ogawa! Added a comment here to explain the issue. I'll be reworking our internal plugins to avoid accessing config.build next so we can simplify this patching. This explains why you had issues initially with the way we were handling the environment config during build and you needed to pre-merge the environment options into the config to make things work.

@patak-dev patak-dev marked this pull request as ready for review April 28, 2024 05:35
@patak-dev patak-dev merged commit 00079da into vitejs:v6/environment-api Apr 28, 2024
5 of 6 checks passed
@hi-ogawa hi-ogawa deleted the repro-custom-environment-preload branch April 28, 2024 06:10
@hi-ogawa
Copy link
Collaborator Author

Thanks for the quick fix! Confirmed alpha.6 is working on my repo hi-ogawa/vite-environment-examples#51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants