Skip to content

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

Merged
patak-cat merged 3 commits into
vitejs:v6/environment-apifrom
hi-ogawa:repro-custom-environment-preload
Apr 28, 2024
Merged

test(v6): reproduce custom environment preload injection#16541
patak-cat merged 3 commits into
vitejs:v6/environment-apifrom
hi-ogawa:repro-custom-environment-preload

Conversation

@hi-ogawa
Copy link
Copy Markdown
Contributor

@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)

@bolt-new-by-stackblitz
Copy link
Copy Markdown

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

@patak-cat
Copy link
Copy Markdown
Member

patak-cat 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-cat patak-cat marked this pull request as ready for review April 28, 2024 05:35
@patak-cat patak-cat merged commit 00079da into vitejs:v6/environment-api Apr 28, 2024
@hi-ogawa hi-ogawa deleted the repro-custom-environment-preload branch April 28, 2024 06:10
@hi-ogawa
Copy link
Copy Markdown
Contributor 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