diff --git a/nuxt.config.ts b/nuxt.config.ts index 1b8bb9d..365854a 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -1,39 +1,105 @@ // https://nuxt.com/docs/api/configuration/nuxt-config +import { IUser } from "~/models/user"; +import { defineNuxtModule } from "@nuxt/kit"; +// import speedkitHydrate from "nuxt-speedkit/dist/runtime/hydrate.mjs"; + +export type SessionData = IUser; +const ct = + () => + (u: U) => + u; export default defineNuxtConfig({ - devtools: { enabled: true }, - modules: [ - '@ant-design-vue/nuxt', - '@sidebase/nuxt-auth', - '@pinia/nuxt' - ], - css: [ "~/public/fonts.css", "~/public/css/all.css" ], - auth: { - provider: { - type: "local" - } - }, - nitro: { - esbuild: { - options: { - minify: false - } - } - }, - runtimeConfig: { - captchaSecret: process.env.CAPTCHASECRET, - database: { - user: process.env.DBUSER, - password: process.env.DBPASS, - uri: `mongodb://${process.env.DB}` - }, - jwt: process.env.JWT, - public: { - // apiBase: "/api" - } - }, - devServer: { - port: 3000, - host: "127.0.0.1", - url: "[::1]" - } -}) + experimental: { + watcher: "chokidar-granular", + // noScripts: true, + treeshakeClientOnly: false, + }, + devtools: { enabled: false }, + modules: [ + "vue-recaptcha/nuxt", + "@ant-design-vue/nuxt", + "@sidebase/nuxt-auth", + "@pinia/nuxt", + "@vueuse/nuxt", + // defineNuxtModule({ + // async setup(options, nuxt) { + // nuxt.hook("components:extend", (components) => { + // // console.log(components); + // // components = components.map((a) => { + // // return speedkitHydrate(() => import(a.filePath)); + // // }); + // }); + // }, + // }), + // "nuxt-speedkit", + ], + // speedkit: { + // disableNuxtFontaine: true, + // }, + css: ["~/public/fonts.css", "~/public/css/all.css"], + auth: { + provider: { + type: "local", + pages: { + login: "/login", + }, + token: { + signInResponseTokenPointer: "/token", + type: "Bearer", + headerName: "Authorization", + maxAgeInSeconds: 168 * 24 * 60 * 60, + sameSiteAttribute: "lax", + }, + sessionDataType: {} as { [Property in keyof IUser]: string }, + endpoints: { + signUp: { path: "/register", method: "post" }, + }, + }, + globalAppMiddleware: { + isEnabled: false, + }, + }, + nitro: { + esbuild: { + options: { + minify: true, + // sourceMap: false, + }, + }, + }, + + // routeRules: { + // "/**": { + // cache: { + // maxAge: 60, + // headersOnly: true, + // }, + // // swr: 60 * 60, + // }, + // }, + // ssr: false, + runtimeConfig: { + captcha: { + secret: process.env.CAPTCHASECRET, + key: process.env.CAPTCHAKEY, + }, + database: { + user: process.env.DBUSER, + password: process.env.DBPASS, + uri: `mongodb://${process.env.DB}`, + }, + jwt: process.env.JWT, + public: { + recaptcha: { + v2SiteKey: process.env.CAPTCHAKEY, + }, + // apiBase: "/api" + }, + nodebb: { + masterToken: process.env.nbb_bearer, + }, + }, + // components: { + // transform: (str) => + // }, +});