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