Skip to content

refactor: use environment consumer to detect SSR - #819

Open
btea wants to merge 1 commit into
vitejs:mainfrom
btea:refactor/ssr-env-consumer
Open

refactor: use environment consumer to detect SSR#819
btea wants to merge 1 commit into
vitejs:mainfrom
btea:refactor/ssr-env-consumer

Conversation

@btea

@btea btea commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Replace the deprecated opt.ssr transform option with this.environment.config.consumer === 'server' in both plugin-vue and plugin-vue-jsx.

The ssr flag on the transform hook options is deprecated in favor of the environment API. Using environment.config.consumer is the recommended way to determine whether the current transform runs in a server (SSR) environment.

https://vite.dev/changes/this-environment-in-hooks#migration-guide

Replace the deprecated `opt.ssr` transform option with
`this.environment.config.consumer === 'server'` in both
plugin-vue and plugin-vue-jsx.
@pkg-pr-new

pkg-pr-new Bot commented Jul 20, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@vitejs/plugin-vue@819
npm i https://pkg.pr.new/@vitejs/plugin-vue-jsx@819

commit: c4d9913

@sapphi-red

Copy link
Copy Markdown
Member

this.environment was introduced in v6.0, but plugin-vue and plugin-vue-jsx supports Vite 5. Maybe we can cut a new major with babel 8, dropping Vite 5,6,7, Node 20.

@btea

btea commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Yeah, this looks good.

@sapphi-red

Copy link
Copy Markdown
Member

@sxzz @edison1105 any thoughts?

@sxzz

sxzz commented Jul 24, 2026

Copy link
Copy Markdown
Member

LGTM, also suggest required node version "node": "^22.18.0 || ^24.11.0 || >=26.0.0".

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.

3 participants