optimize build process for low mem
This commit is contained in:
+16
-1
@@ -4,10 +4,25 @@
|
||||
*/
|
||||
import "./src/env.js";
|
||||
|
||||
const isDockerBuild = process.env.DOCKER_BUILD === "1";
|
||||
const disableReactCompiler = process.env.DISABLE_REACT_COMPILER === "1";
|
||||
|
||||
/** @type {import("next").NextConfig} */
|
||||
const config = {
|
||||
reactCompiler: true,
|
||||
// React Compiler is helpful in dev/prod but adds compile-time memory pressure in Docker builds.
|
||||
reactCompiler: !disableReactCompiler,
|
||||
productionBrowserSourceMaps: false,
|
||||
serverExternalPackages: ["pg", "better-auth"],
|
||||
experimental: {
|
||||
webpackMemoryOptimizations: true,
|
||||
},
|
||||
// Skip duplicate typecheck/eslint during Docker `next build` to lower peak memory.
|
||||
...(isDockerBuild
|
||||
? {
|
||||
typescript: { ignoreBuildErrors: true },
|
||||
eslint: { ignoreDuringBuilds: true },
|
||||
}
|
||||
: {}),
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
||||
Reference in New Issue
Block a user