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

feat: add isSsrTargetWebWorker flag to configEnvironment hook #18620

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sapphi-red
Copy link
Member

Description

This PR adds isSsrTargetWebWorker flag to configEnvironment hook so that plugins can support ssr.target: 'webworker' correctly.
For example, this configEnvironment hook from sveltejs/vite-plugin-svelte#1020 needs to know if ssr.target: 'webworker' is set.
https://github.com/sveltejs/vite-plugin-svelte/blob/dcec9afa2a9b1bfd5fe8f0767cc871a2b144a9d6/packages/vite-plugin-svelte/src/index.js#L71-L81

https://discord.com/channels/804011606160703521/1304311237332697098/1304350474085859338

@sapphi-red sapphi-red added the feat: environment API Vite Environment API label Nov 8, 2024
Copy link
Member

@patak-dev patak-dev left a comment

Choose a reason for hiding this comment

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

I think this is ok for v6. Do you know how we can get out of it? Do we need another option so this hack isn't needed?
Edit: oh, IIUC, we could just remove it once v5 support is no longer needed. Talking about that, I wonder if svelte will end up doing a clean cut and require Vite 6 soon after we release

Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

I'm personally still a bit unsure that resolve.conditions now exclusively only applies to client is a nice behaviour, especially that we try to match compat for the environment API, but I don't think it's worth spiraling into that discussion for now 😅 I'll try to test some things locally on my own.

@bluwy
Copy link
Member

bluwy commented Nov 12, 2024

Talking about that, I wonder if svelte will end up doing a clean cut and require Vite 6 soon after we release

Dominik is fine with that for vite-plugin-svelte, but we'll likely have to align with sveltekit and the plan could change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: environment API Vite Environment API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants