Mount /vip with nomadvip+payjsapi, add @nomadro/pay|pb|sdk, apps/api, /admin shell, and backup/rollback scripts under git.nomadro.cn workflow. Co-authored-by: Cursor <cursoragent@cursor.com>
54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
import path from "node:path";
|
|
import type { NextConfig } from "next";
|
|
|
|
const API_URL = (process.env.API_URL || "http://127.0.0.1:8000").replace(
|
|
/\/$/,
|
|
"",
|
|
);
|
|
|
|
const aliases = {
|
|
"@ebook": path.resolve(__dirname, "apps/ebook/src"),
|
|
"@community": path.resolve(__dirname, "apps/nomadweb/frontend/src"),
|
|
"@navmini": path.resolve(__dirname, "apps/navmini/src"),
|
|
"@vip": path.resolve(__dirname, "apps/nomadvip"),
|
|
"@nomadro/pay": path.resolve(__dirname, "packages/pay/src/index.ts"),
|
|
"@nomadro/pb": path.resolve(__dirname, "packages/pb/src/index.ts"),
|
|
"@nomadro/sdk": path.resolve(__dirname, "packages/sdk/src/index.ts"),
|
|
};
|
|
|
|
const nextConfig: NextConfig = {
|
|
experimental: {
|
|
externalDir: true,
|
|
},
|
|
transpilePackages: ["@nomadro/pay", "@nomadro/pb", "@nomadro/sdk"],
|
|
turbopack: {
|
|
resolveAlias: {
|
|
"@ebook": "./apps/ebook/src",
|
|
"@community": "./apps/nomadweb/frontend/src",
|
|
"@navmini": "./apps/navmini/src",
|
|
"@vip": "./apps/nomadvip",
|
|
"@nomadro/pay": "./packages/pay/src/index.ts",
|
|
"@nomadro/pb": "./packages/pb/src/index.ts",
|
|
"@nomadro/sdk": "./packages/sdk/src/index.ts",
|
|
},
|
|
},
|
|
webpack: (config) => {
|
|
config.resolve.alias = {
|
|
...config.resolve.alias,
|
|
...aliases,
|
|
};
|
|
return config;
|
|
},
|
|
async rewrites() {
|
|
return [
|
|
// Community/ebook FastAPI uses /api/v1 — do not steal VIP Next handlers at /api/pay|auth|vip
|
|
{
|
|
source: "/api/v1/:path*",
|
|
destination: `${API_URL}/api/v1/:path*`,
|
|
},
|
|
];
|
|
},
|
|
};
|
|
|
|
export default nextConfig;
|