Skip to content

Commit be03b1a

Browse files
committed
fix: Begin to support Vite's Environment API & plugins that use it
1 parent f404808 commit be03b1a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/plugins/prerender-plugin.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,14 @@ export function prerenderPlugin({ prerenderScript, renderTarget, additionalPrere
125125
name: 'vite-prerender-plugin',
126126
apply: 'build',
127127
enforce: 'post',
128+
applyToEnvironment(environment) {
129+
return environment.name == 'client';
130+
},
128131
// Vite is pretty inconsistent with how it resolves config options, both
129132
// hooks are needed to set their respective options. ¯\_(ツ)_/¯
130133
config(config) {
134+
// Only required for Vite 5 and older. In 6+, this is handled by the
135+
// Environment API (`applyToEnvironment`)
131136
if (config.build?.ssr) {
132137
ssrBuild = true
133138
return;

0 commit comments

Comments
 (0)