perf(nuxt): re-enable caching

This commit is contained in:
parent 25a68b1f3e
commit 653d5c5f32
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -1,6 +1,5 @@
// https://nuxt.com/docs/api/configuration/nuxt-config // https://nuxt.com/docs/api/configuration/nuxt-config
import { IUser } from "~/models/user"; import { IUser } from "~/models/user";
import { defineNuxtModule } from "@nuxt/kit";
// import speedkitHydrate from "nuxt-speedkit/dist/runtime/hydrate.mjs"; // import speedkitHydrate from "nuxt-speedkit/dist/runtime/hydrate.mjs";
export type SessionData = IUser; export type SessionData = IUser;
@ -10,7 +9,7 @@ const cac = {
cache: { cache: {
headersOnly: true, headersOnly: true,
// integrity: "", // integrity: "",
// varies: ["Content-Length"], varies: ["Content-Length", "Cookie"],
maxAge: 60, maxAge: 60,
}, },
swr: false, swr: false,
@ -33,6 +32,7 @@ export default defineNuxtConfig({
"@pinia/nuxt", "@pinia/nuxt",
"@vueuse/nuxt", "@vueuse/nuxt",
"nuxt-speedkit", "nuxt-speedkit",
// "./modules/09.loaded",
], ],
speedkit: { speedkit: {
disableNuxtFontaine: true, disableNuxtFontaine: true,
@ -56,7 +56,7 @@ export default defineNuxtConfig({
maxAgeInSeconds: 14 * 24 * 60 * 60, maxAgeInSeconds: 14 * 24 * 60 * 60,
// sameSiteAttribute: , // sameSiteAttribute: ,
}, },
sessionDataType: {} as { [Property in keyof IUser]: string }, sessionDataType: {} as IUser,
endpoints: { endpoints: {
signUp: { path: "/register", method: "post" }, signUp: { path: "/register", method: "post" },
signOut: { path: "/logout", method: "post" }, signOut: { path: "/logout", method: "post" },
@ -81,18 +81,20 @@ export default defineNuxtConfig({
sourceMap: "inline", sourceMap: "inline",
}, },
}, },
preset: "node", preset: "node-server",
}, },
routeRules: { routeRules: {
"/": cac, "/": cac,
"/api/**": { cors: true }, "/api/**": { cors: true },
"/bands/**": cac, "/band/**": cac,
"/authors": cac, "/authors": cac,
"/story/**": { "/story/**": {
swr: true, swr: true,
isr: true, isr: true,
cache: { cache: {
maxAge: 1800, maxAge: 1800,
headersOnly: true,
varies: ["Cookie", "Set-Cookie"],
}, },
}, },
// "/authors": { swr: 0 }, // "/authors": { swr: 0 },