Ship portal module + /api/social/v1 SQLite backend separate from /community; update README for MiroTalk CSP and test5 as the next development branch. Co-authored-by: Cursor <cursoragent@cursor.com>
99 lines
2.6 KiB
TypeScript
99 lines
2.6 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,
|
|
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;
|