@mandujs/core 0.39.0 → 0.39.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/runtime/server.ts +15 -6
package/package.json
CHANGED
package/src/runtime/server.ts
CHANGED
|
@@ -3785,13 +3785,22 @@ async function handleRequestInternal(
|
|
|
3785
3785
|
// Must run BEFORE static-file serving and route dispatch so that
|
|
3786
3786
|
// `mandu build`-emitted HTML short-circuits SSR. No-op if the
|
|
3787
3787
|
// feature is disabled or the path wasn't prerendered.
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3788
|
+
//
|
|
3789
|
+
// #232 — In dev mode we SKIP the prerender cache entirely. The cache is
|
|
3790
|
+
// populated by `mandu build` and never invalidated during `mandu dev`, so
|
|
3791
|
+
// keeping it in the dev path causes the browser to see stale HTML after
|
|
3792
|
+
// HMR signals "full reload" — user saves a file, reloads, and the old
|
|
3793
|
+
// prerendered output wins. Production `mandu start` always runs with
|
|
3794
|
+
// `isDev: false`, so prod behavior is unchanged.
|
|
3795
|
+
if (!settings.isDev) {
|
|
3796
|
+
const prerendered = await tryServePrerendered(pathname, settings, req.method, req);
|
|
3797
|
+
if (prerendered) {
|
|
3798
|
+
if (settings.cors && isCorsRequest(req)) {
|
|
3799
|
+
const corsOptions: CorsOptions = typeof settings.cors === 'object' ? settings.cors : {};
|
|
3800
|
+
return ok(applyCorsToResponse(prerendered, req, corsOptions));
|
|
3801
|
+
}
|
|
3802
|
+
return ok(prerendered);
|
|
3793
3803
|
}
|
|
3794
|
-
return ok(prerendered);
|
|
3795
3804
|
}
|
|
3796
3805
|
|
|
3797
3806
|
// ─── Phase 18.μ — i18n dispatch ─────────────────────────────────────────
|