chore(nuxt): cleanup nuxt config
This commit is contained in:
parent
4da096fa33
commit
0f21f7896e
@ -1,40 +1,23 @@
|
|||||||
// 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 { render } from "vue";
|
||||||
|
import { rc } from "@server/constants";
|
||||||
|
import { defineNuxtConfig } from "nuxt/config";
|
||||||
import { fileURLToPath } from "url";
|
import { fileURLToPath } from "url";
|
||||||
// import speedkitHydrate from "nuxt-speedkit/dist/runtime/hydrate.mjs";
|
|
||||||
|
|
||||||
export type SessionData = IUser;
|
|
||||||
const cac = {
|
const cac = {
|
||||||
isr: true,
|
isr: true,
|
||||||
headersOnly: true,
|
headersOnly: true,
|
||||||
cache: {
|
cache: {
|
||||||
headersOnly: true,
|
headersOnly: true,
|
||||||
// integrity: "",
|
|
||||||
varies: ["Content-Length", "Cookie"],
|
varies: ["Content-Length", "Cookie"],
|
||||||
maxAge: 60,
|
maxAge: 60,
|
||||||
},
|
},
|
||||||
swr: false,
|
swr: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const stor = {
|
|
||||||
db: {
|
|
||||||
driver: "mongodb",
|
|
||||||
connectionString:
|
|
||||||
process.env.NODE_ENV == "production"
|
|
||||||
? `mongodb://${process.env.DBUSER}:${process.env.DBPASS}@localhost:27017/${process.env.DBNAME}`
|
|
||||||
: `mongodb://localhost:27017/${process.env.DBNAME}`,
|
|
||||||
databaseName: process.env.DBNAME,
|
|
||||||
collectionName: "cache",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
const ct =
|
|
||||||
<T>() =>
|
|
||||||
<U extends T>(u: U) =>
|
|
||||||
u;
|
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
experimental: {
|
experimental: {
|
||||||
watcher: "chokidar-granular",
|
watcher: "chokidar-granular",
|
||||||
// noScripts: true,
|
|
||||||
treeshakeClientOnly: true,
|
treeshakeClientOnly: true,
|
||||||
},
|
},
|
||||||
devtools: { enabled: true },
|
devtools: { enabled: true },
|
||||||
@ -44,9 +27,8 @@ export default defineNuxtConfig({
|
|||||||
"@sidebase/nuxt-auth",
|
"@sidebase/nuxt-auth",
|
||||||
"@pinia/nuxt",
|
"@pinia/nuxt",
|
||||||
"@vueuse/nuxt",
|
"@vueuse/nuxt",
|
||||||
"nuxt-speedkit",
|
"@nuxt/test-utils/module",
|
||||||
// "@nuxtjs/i18n",
|
// "@nuxtjs/i18n",
|
||||||
// "./modules/09.loaded",
|
|
||||||
],
|
],
|
||||||
// i18n: {
|
// i18n: {
|
||||||
// vueI18n: `./i18n.config.ts`,
|
// vueI18n: `./i18n.config.ts`,
|
||||||
@ -54,13 +36,6 @@ export default defineNuxtConfig({
|
|||||||
antd: {
|
antd: {
|
||||||
extractStyle: true,
|
extractStyle: true,
|
||||||
},
|
},
|
||||||
speedkit: {
|
|
||||||
disableNuxtFontaine: true,
|
|
||||||
lazyOffset: {
|
|
||||||
component: "0%",
|
|
||||||
asset: "0%",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
css: ["~/public/fonts.css", "~/public/css/all.css"],
|
css: ["~/public/fonts.css", "~/public/css/all.css"],
|
||||||
auth: {
|
auth: {
|
||||||
baseURL: "/api/auth",
|
baseURL: "/api/auth",
|
||||||
@ -101,10 +76,19 @@ export default defineNuxtConfig({
|
|||||||
enableRefreshOnWindowFocus: false,
|
enableRefreshOnWindowFocus: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
vite: {
|
||||||
|
esbuild: {
|
||||||
|
logLimit: 0,
|
||||||
|
logLevel: "debug",
|
||||||
|
},
|
||||||
|
logLevel: "info",
|
||||||
|
},
|
||||||
nitro: {
|
nitro: {
|
||||||
esbuild: {
|
esbuild: {
|
||||||
options: {
|
options: {
|
||||||
minify: true,
|
minify: true,
|
||||||
|
// loader: "default",
|
||||||
|
logLevel: "verbose",
|
||||||
// sourceMap: "inline",
|
// sourceMap: "inline",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -124,60 +108,21 @@ export default defineNuxtConfig({
|
|||||||
varies: ["Cookie", "Set-Cookie"],
|
varies: ["Cookie", "Set-Cookie"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// "/authors": { swr: 0 },
|
|
||||||
// "/bands": { swr: 0 },
|
|
||||||
},
|
},
|
||||||
// routeRules: {
|
|
||||||
// "/**": {
|
|
||||||
// cache: {
|
|
||||||
// maxAge: 60,
|
|
||||||
// headersOnly: true,
|
|
||||||
// },
|
|
||||||
// // swr: 60 * 60,
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// ssr: false,
|
|
||||||
alias: {
|
alias: {
|
||||||
"@models": fileURLToPath(new URL("./models", import.meta.url)),
|
"@models": fileURLToPath(new URL("./models", import.meta.url)),
|
||||||
"@client": fileURLToPath(new URL("./lib/client", import.meta.url)),
|
"@client": fileURLToPath(new URL("./lib/client", import.meta.url)),
|
||||||
"@server": fileURLToPath(new URL("./lib/server", import.meta.url)),
|
"@server": fileURLToPath(new URL("./lib/server", import.meta.url)),
|
||||||
"@functions": fileURLToPath(new URL("./lib/functions.ts", import.meta.url)),
|
"@functions": fileURLToPath(new URL("./lib/functions.ts", import.meta.url)),
|
||||||
"@dbconfig": fileURLToPath(new URL("./lib/dbconfig.ts", import.meta.url)),
|
"@dbconfig": fileURLToPath(new URL("./lib/dbconfig.ts", import.meta.url)),
|
||||||
|
"@test": fileURLToPath(new URL("./lib/testing/", import.meta.url)),
|
||||||
},
|
},
|
||||||
sourcemap: {
|
sourcemap: {
|
||||||
server: true,
|
server: true,
|
||||||
client: true,
|
client: true,
|
||||||
},
|
},
|
||||||
runtimeConfig: {
|
runtimeConfig: rc,
|
||||||
captcha: {
|
|
||||||
secret: process.env.CAPTCHASECRET,
|
|
||||||
key: process.env.CAPTCHAKEY,
|
|
||||||
},
|
|
||||||
database: {
|
|
||||||
user: process.env.DBUSER,
|
|
||||||
password: process.env.DBPASS,
|
|
||||||
name: process.env.DBNAME,
|
|
||||||
uri: `mongodb://${process.env.DB}`,
|
|
||||||
},
|
|
||||||
jwt: process.env.JWT,
|
|
||||||
public: {
|
|
||||||
recaptcha: {
|
|
||||||
v2SiteKey: process.env.CAPTCHAKEY,
|
|
||||||
},
|
|
||||||
auth: {
|
|
||||||
computed: {
|
|
||||||
origin: "127.0.0.1",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
// apiBase: "/api"
|
|
||||||
},
|
|
||||||
nodebb: {
|
|
||||||
masterToken: process.env.nbb_bearer,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
// components: {
|
|
||||||
// transform: (str) =>
|
|
||||||
// },
|
|
||||||
typescript: {
|
typescript: {
|
||||||
tsConfig: {
|
tsConfig: {
|
||||||
exclude: ["./.nuxt/types/auth.d.ts"],
|
exclude: ["./.nuxt/types/auth.d.ts"],
|
||||||
|
Loading…
Reference in New Issue
Block a user