mirror of
https://github.com/decolua/9router.git
synced 2026-05-08 12:01:28 +00:00
Move better-sqlite3 to optionalDependencies so npm install doesn't fail on platforms without native build tools. Add it to serverExternalPackages so Next.js doesn't try to bundle the native addon into webpack chunks. Fixes #243
49 lines
1.1 KiB
JavaScript
49 lines
1.1 KiB
JavaScript
/** @type {import('next').NextConfig} */
|
|
const nextConfig = {
|
|
output: "standalone",
|
|
serverExternalPackages: ["better-sqlite3"],
|
|
images: {
|
|
unoptimized: true
|
|
},
|
|
env: {},
|
|
webpack: (config, { isServer }) => {
|
|
// Ignore fs/path modules in browser bundle
|
|
if (!isServer) {
|
|
config.resolve.fallback = {
|
|
...config.resolve.fallback,
|
|
fs: false,
|
|
path: false,
|
|
};
|
|
}
|
|
// Stop watching logs directory to prevent HMR during streaming
|
|
config.watchOptions = { ...config.watchOptions, ignored: /[\\/](logs|\.next)[\\/]/ };
|
|
return config;
|
|
},
|
|
async rewrites() {
|
|
return [
|
|
{
|
|
source: "/v1/v1/:path*",
|
|
destination: "/api/v1/:path*"
|
|
},
|
|
{
|
|
source: "/v1/v1",
|
|
destination: "/api/v1"
|
|
},
|
|
{
|
|
source: "/codex/:path*",
|
|
destination: "/api/v1/responses"
|
|
},
|
|
{
|
|
source: "/v1/:path*",
|
|
destination: "/api/v1/:path*"
|
|
},
|
|
{
|
|
source: "/v1",
|
|
destination: "/api/v1"
|
|
}
|
|
];
|
|
}
|
|
};
|
|
|
|
export default nextConfig;
|