feat: add basePath env

This commit is contained in:
hamster1963 2024-11-17 22:41:55 +08:00
parent 348519ed5b
commit 39ed9f4a86
4 changed files with 7 additions and 3 deletions

View File

@ -13,3 +13,4 @@ NEXT_PUBLIC_CustomLogo=https://nezha-cf.buycoffee.top/apple-touch-icon.png
NEXT_PUBLIC_CustomTitle=NezhaDash NEXT_PUBLIC_CustomTitle=NezhaDash
NEXT_PUBLIC_CustomDescription=NezhaDash is a dashboard for Nezha. NEXT_PUBLIC_CustomDescription=NezhaDash is a dashboard for Nezha.
NEXT_PUBLIC_DisableIndex=false NEXT_PUBLIC_DisableIndex=false
NEXT_PUBLIC_BASE_PATH=/dash

BIN
bun.lockb

Binary file not shown.

View File

@ -1,6 +1,8 @@
import withPWAInit from "@ducanh2912/next-pwa"; import withPWAInit from "@ducanh2912/next-pwa";
import withBundleAnalyzer from "@next/bundle-analyzer"; import withBundleAnalyzer from "@next/bundle-analyzer";
import createNextIntlPlugin from "next-intl/plugin"; import createNextIntlPlugin from "next-intl/plugin";
import { env } from "next-runtime-env";
const bundleAnalyzer = withBundleAnalyzer({ const bundleAnalyzer = withBundleAnalyzer({
enabled: process.env.ANALYZE === "true", enabled: process.env.ANALYZE === "true",
@ -22,6 +24,7 @@ const withPWA = withPWAInit({
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
output: "standalone", output: "standalone",
basePath: env("NEXT_PUBLIC_BASE_PATH") || "",
logging: { logging: {
fetches: { fetches: {
fullUrl: true, fullUrl: true,

View File

@ -51,19 +51,19 @@
"typescript-eslint": "^8.14.0" "typescript-eslint": "^8.14.0"
}, },
"devDependencies": { "devDependencies": {
"eslint-plugin-turbo": "^2.2.3", "eslint-plugin-turbo": "^2.3.0",
"eslint-plugin-unused-imports": "^4.1.4", "eslint-plugin-unused-imports": "^4.1.4",
"@next/bundle-analyzer": "^15.0.3", "@next/bundle-analyzer": "^15.0.3",
"@types/node": "^22.9.0", "@types/node": "^22.9.0",
"@types/react": "npm:types-react@19.0.0-rc.1", "@types/react": "npm:types-react@19.0.0-rc.1",
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.1", "@types/react-dom": "npm:types-react-dom@19.0.0-rc.1",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"eslint": "^9.14.0", "eslint": "^9.15.0",
"eslint-config-next": "^15.0.3", "eslint-config-next": "^15.0.3",
"postcss": "^8.4.49", "postcss": "^8.4.49",
"prettier": "^3.3.3", "prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.8", "prettier-plugin-tailwindcss": "^0.6.8",
"tailwindcss": "^3.4.14", "tailwindcss": "^3.4.15",
"typescript": "^5.6.3" "typescript": "^5.6.3"
}, },
"overrides": { "overrides": {