chore(nuxt): update nuxt config

enable nitro minification
This commit is contained in:
parent a6dd1002e2
commit 00e2457aab
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -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 =
<T>() =>
<U extends T>(u: U) =>
u;
export default defineNuxtConfig({
devtools: { enabled: true },
experimental: {
watcher: "chokidar-granular",
// noScripts: true,
treeshakeClientOnly: false,
},
devtools: { enabled: false },
modules: [
'@ant-design-vue/nuxt',
'@sidebase/nuxt-auth',
'@pinia/nuxt'
"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"
}
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: false
}
}
minify: true,
// sourceMap: false,
},
},
},
// routeRules: {
// "/**": {
// cache: {
// maxAge: 60,
// headersOnly: true,
// },
// // swr: 60 * 60,
// },
// },
// ssr: false,
runtimeConfig: {
captchaSecret: process.env.CAPTCHASECRET,
captcha: {
secret: process.env.CAPTCHASECRET,
key: process.env.CAPTCHAKEY,
},
database: {
user: process.env.DBUSER,
password: process.env.DBPASS,
uri: `mongodb://${process.env.DB}`
uri: `mongodb://${process.env.DB}`,
},
jwt: process.env.JWT,
public: {
// apiBase: "/api"
}
recaptcha: {
v2SiteKey: process.env.CAPTCHAKEY,
},
devServer: {
port: 3000,
host: "127.0.0.1",
url: "[::1]"
}
})
// apiBase: "/api"
},
nodebb: {
masterToken: process.env.nbb_bearer,
},
},
// components: {
// transform: (str) =>
// },
});