next/nuxt.config.ts

138 lines
2.8 KiB
TypeScript
Raw Permalink Normal View History

2023-09-23 15:58:51 -04:00
// https://nuxt.com/docs/api/configuration/nuxt-config
import { IUser } from "@models/user";
2024-03-21 18:43:29 -04:00
import { render } from "vue";
import { rc } from "@server/constants";
import { defineNuxtConfig } from "nuxt/config";
import { fileURLToPath } from "url";
const cac = {
isr: true,
headersOnly: true,
cache: {
headersOnly: true,
2023-12-06 21:58:35 -05:00
varies: ["Content-Length", "Cookie"],
maxAge: 60,
},
swr: false,
};
2023-09-23 15:58:51 -04:00
export default defineNuxtConfig({
experimental: {
watcher: "chokidar-granular",
treeshakeClientOnly: true,
},
devtools: { enabled: true },
modules: [
"vue-recaptcha/nuxt",
"@ant-design-vue/nuxt",
"@sidebase/nuxt-auth",
"@pinia/nuxt",
"@vueuse/nuxt",
2024-03-21 18:43:29 -04:00
"@nuxt/test-utils/module",
// "@nuxtjs/i18n",
],
// i18n: {
// vueI18n: `./i18n.config.ts`,
// },
antd: {
extractStyle: true,
},
css: ["~/public/fonts.css", "~/public/css/all.css"],
auth: {
baseURL: "/api/auth",
provider: {
type: "refresh",
pages: {
login: "/auth/login",
},
token: {
signInResponseTokenPointer: "/token/access",
type: "Bearer",
headerName: "Authorization",
maxAgeInSeconds: 14 * 24 * 60 * 60,
},
refreshToken: {
signInResponseRefreshTokenPointer: "/token/refresh",
},
2023-12-09 17:49:09 -05:00
// @ts-ignore
2023-12-06 21:58:35 -05:00
sessionDataType: {} as IUser,
endpoints: {
signUp: { path: "/register", method: "post" },
signOut: { path: "/logout", method: "post" },
getSession: {
path: "/session",
method: "get",
},
refresh: {
path: "/refresh",
method: "post",
},
},
},
globalAppMiddleware: false,
//@ts-ignore
session: {
enableRefreshPeriodically: 60 * 60 * 2 * 1000,
enableRefreshOnWindowFocus: false,
},
},
2024-03-21 18:43:29 -04:00
vite: {
esbuild: {
logLimit: 0,
logLevel: "debug",
},
logLevel: "info",
},
nitro: {
esbuild: {
options: {
minify: true,
2024-03-21 18:43:29 -04:00
// loader: "default",
logLevel: "verbose",
// sourceMap: "inline",
},
},
preset: process.env.NODE_ENV == "production" ? "bun" : "node-server",
},
routeRules: {
"/": cac,
"/api/**": { cors: true },
2023-12-06 21:58:35 -05:00
"/band/**": cac,
"/authors": cac,
"/story/**": {
swr: true,
isr: true,
cache: {
maxAge: 1800,
2023-12-06 21:58:35 -05:00
headersOnly: true,
varies: ["Cookie", "Set-Cookie"],
},
},
},
2024-03-21 18:43:29 -04:00
alias: {
"@models": fileURLToPath(new URL("./models", import.meta.url)),
"@client": fileURLToPath(new URL("./lib/client", import.meta.url)),
"@server": fileURLToPath(new URL("./lib/server", import.meta.url)),
"@functions": fileURLToPath(new URL("./lib/functions.ts", import.meta.url)),
"@dbconfig": fileURLToPath(new URL("./lib/dbconfig.ts", import.meta.url)),
2024-03-21 18:43:29 -04:00
"@test": fileURLToPath(new URL("./lib/testing/", import.meta.url)),
},
sourcemap: {
server: true,
client: true,
},
2024-03-21 18:43:29 -04:00
runtimeConfig: rc,
typescript: {
tsConfig: {
exclude: ["./.nuxt/types/auth.d.ts"],
},
},
imports: {
autoImport: true,
dirsScanOptions: {
types: true,
},
},
});