c20faa665b
- 将 nanoid 从 3.3.11 版本升级到 5.1.11 版本 - 修改 createId 函数使用 nanoid 替代 crypto.randomUUID - 在 next.config.ts 中添加开发环境允许的来源配置 - 更新 bun.lock 文件中的依赖版本信息
26 lines
865 B
TypeScript
26 lines
865 B
TypeScript
import type { NextConfig } from "next";
|
|
import { PHASE_DEVELOPMENT_SERVER } from "next/constants";
|
|
import { readFileSync } from "node:fs";
|
|
import { fileURLToPath } from "node:url";
|
|
import { dirname, resolve } from "node:path";
|
|
|
|
const apiBaseUrl = process.env.API_BASE_URL || "http://127.0.0.1:3000";
|
|
const webDir = dirname(fileURLToPath(import.meta.url));
|
|
const version = readFileSync(resolve(webDir, "../VERSION"), "utf8").trim() || "dev";
|
|
|
|
export default function nextConfig(phase: string): NextConfig {
|
|
const isDev = phase === PHASE_DEVELOPMENT_SERVER;
|
|
return {
|
|
allowedDevOrigins: isDev ? ["*.*.*.*"] : [],
|
|
typescript: {
|
|
ignoreBuildErrors: true,
|
|
},
|
|
env: {
|
|
NEXT_PUBLIC_APP_VERSION: version,
|
|
},
|
|
async rewrites() {
|
|
return isDev ? [{ source: "/api/:path*", destination: `${apiBaseUrl}/api/:path*` }] : [];
|
|
},
|
|
};
|
|
}
|