Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/plugin-rsc/examples/ssg/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ function rscSsgPlugin(): Plugin[] {
return {
appType: env.isPreview ? 'mpa' : undefined,
rsc: {
useBuildAppHook: true,
serverHandler: env.isPreview ? false : undefined,
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export default defineConfig({
},
serverHandler: false,
loadModuleDevProxy: true,
useBuildAppHook: true,
}),
cloudflare({
configPath: './wrangler.jsonc',
Expand Down
7 changes: 6 additions & 1 deletion packages/plugin-rsc/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export type RscPluginOptions = {
/**
* use `Plugin.buildApp` hook (introduced on Vite 7) instead of `builder.buildApp` configuration
* for better composability with other plugins.
* @default false
* @default true since Vite 7
*/
useBuildAppHook?: boolean

Expand Down Expand Up @@ -428,6 +428,11 @@ export default function vitePluginRsc(
},
}
},
configResolved() {
if (Number(vite.version.split('.')[0]) >= 7) {
rscPluginOptions.useBuildAppHook ??= true
}
},
buildApp: {
async handler(builder) {
if (rscPluginOptions.useBuildAppHook) {
Expand Down
Loading