Skip to content

Commit 8ed40aa

Browse files
committed
feat(plugin): add config function to handle SSR processing for hono-ssr
1 parent b1f421d commit 8ed40aa

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

src/plugins/file-route.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,28 @@ export function FileRoutesPlugin(options?: HonoSSRFileRouteOptions): Plugin {
2626

2727
return {
2828
name: 'hono-ssr:file-routes',
29+
config(userConfig) {
30+
// Ensure @soybeanjs/hono-ssr is processed by Vite's SSR pipeline so that
31+
// the virtual:hono-file-routes import inside the package can be resolved.
32+
const existing = userConfig.ssr?.noExternal;
33+
if (existing === true) {
34+
return;
35+
}
36+
const packageName = '@soybeanjs/hono-ssr';
37+
const currentList = Array.isArray(existing)
38+
? existing
39+
: existing
40+
? [existing]
41+
: [];
42+
if (currentList.includes(packageName)) {
43+
return;
44+
}
45+
return {
46+
ssr: {
47+
noExternal: [...currentList, packageName]
48+
}
49+
};
50+
},
2951
configResolved(resolvedConfig) {
3052
config = resolvedConfig;
3153
},

0 commit comments

Comments
 (0)