Includes social realtime entrypoints, weapp audit book surfaces, VIP analytics track routes, MiroTalk/Centrifugo deploy helpers, and related admin/config wiring. Excludes local DB dumps and .tmp probe scripts. Co-authored-by: Cursor <cursoragent@cursor.com>
103 lines
2.7 KiB
TypeScript
103 lines
2.7 KiB
TypeScript
import path from "node:path";
|
||
import type { NextConfig } from "next";
|
||
|
||
const API_URL = (process.env.API_URL || "http://127.0.0.1:8080").replace(
|
||
/\/$/,
|
||
"",
|
||
);
|
||
|
||
/** 门户前端均在 src/;禁止再指向已删除的垂直仓 */
|
||
const aliases = {
|
||
"@ebook": path.resolve(__dirname, "src/modules/ebook"),
|
||
"@community": path.resolve(__dirname, "src/modules/community"),
|
||
"@social": path.resolve(__dirname, "src/modules/social"),
|
||
"@navmini": path.resolve(__dirname, "src/modules/nav"),
|
||
"@vip": path.resolve(__dirname, "src/modules/vip"),
|
||
"@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 = {
|
||
poweredByHeader: false,
|
||
compress: true,
|
||
typescript: {
|
||
// 生产机内存紧;social/centrifugo 发版勿被无关 admin TS 卡死
|
||
ignoreBuildErrors: true,
|
||
},
|
||
experimental: {
|
||
externalDir: true,
|
||
optimizePackageImports: [
|
||
"antd",
|
||
"@ant-design/icons",
|
||
"lucide-react",
|
||
"framer-motion",
|
||
"three",
|
||
],
|
||
},
|
||
images: {
|
||
formats: ["image/avif", "image/webp"],
|
||
remotePatterns: [
|
||
{ protocol: "https", hostname: "**.nomadro.cn" },
|
||
{ protocol: "https", hostname: "**.nomadro.com" },
|
||
],
|
||
},
|
||
transpilePackages: ["@nomadro/pay", "@nomadro/pb", "@nomadro/sdk"],
|
||
turbopack: {
|
||
resolveAlias: {
|
||
"@ebook": "./src/modules/ebook",
|
||
"@community": "./src/modules/community",
|
||
"@social": "./src/modules/social",
|
||
"@navmini": "./src/modules/nav",
|
||
"@vip": "./src/modules/vip",
|
||
"@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 [
|
||
{
|
||
source: "/vip/ebook/read",
|
||
destination: "/vip/ebook-read",
|
||
},
|
||
{
|
||
source: "/vip/ebook/read/:path*",
|
||
destination: "/vip/ebook-read",
|
||
},
|
||
{
|
||
source: "/vip/ebook/cloudphone",
|
||
destination: "/vip/ebook-cloudphone",
|
||
},
|
||
{
|
||
source: "/api/v1/:path*",
|
||
destination: `${API_URL}/api/v1/:path*`,
|
||
},
|
||
{
|
||
source: "/api/social/:path*",
|
||
destination: `${API_URL}/api/social/:path*`,
|
||
},
|
||
];
|
||
},
|
||
async headers() {
|
||
return [
|
||
{
|
||
source: "/:path*",
|
||
headers: [
|
||
{ key: "X-Content-Type-Options", value: "nosniff" },
|
||
{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
|
||
],
|
||
},
|
||
];
|
||
},
|
||
};
|
||
|
||
export default nextConfig;
|