Skip to content

Commit 0a02b83

Browse files
authored
feat(rsc): enable buildApp plugin hook by default for Vite 7 (#815)
1 parent 3969f86 commit 0a02b83

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

packages/plugin-rsc/examples/ssg/vite.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ function rscSsgPlugin(): Plugin[] {
3535
return {
3636
appType: env.isPreview ? 'mpa' : undefined,
3737
rsc: {
38-
useBuildAppHook: true,
3938
serverHandler: env.isPreview ? false : undefined,
4039
},
4140
}

packages/plugin-rsc/examples/starter-cf-single/vite.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ export default defineConfig({
1717
},
1818
serverHandler: false,
1919
loadModuleDevProxy: true,
20-
useBuildAppHook: true,
2120
}),
2221
cloudflare({
2322
configPath: './wrangler.jsonc',

packages/plugin-rsc/src/plugin.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export type RscPluginOptions = {
174174
/**
175175
* use `Plugin.buildApp` hook (introduced on Vite 7) instead of `builder.buildApp` configuration
176176
* for better composability with other plugins.
177-
* @default false
177+
* @default true since Vite 7
178178
*/
179179
useBuildAppHook?: boolean
180180

@@ -428,6 +428,11 @@ export default function vitePluginRsc(
428428
},
429429
}
430430
},
431+
configResolved() {
432+
if (Number(vite.version.split('.')[0]) >= 7) {
433+
rscPluginOptions.useBuildAppHook ??= true
434+
}
435+
},
431436
buildApp: {
432437
async handler(builder) {
433438
if (rscPluginOptions.useBuildAppHook) {

0 commit comments

Comments
 (0)