#extremely slow compilation and "fast refresh"

1 messages · Page 1 of 1 (latest)

oak ether
#

I have a mid sized app for video editing and its taking really long to compile.
OS: Windows x64 Intel i5 processor
Nextjs Version: 14.0.3
Below is my Nextjs config
import { createRequire } from "module";
const require = createRequire(import.meta.url);

const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: false,
});

await import("./src/env.js");

/** @type {import('next').NextConfig} /
const nextConfig = {
crossOrigin: "anonymous",
async headers() {
return [
{
source: "/public/:path
",
headers: [
{
key: "Cache-Control",
value: "public, max-age=31536000, immutable",
},
],
},
];
},
swcMinify: true,
typescript: {
ignoreBuildErrors: true,
},
eslint: {
ignoreDuringBuilds: true,
},
reactStrictMode: false,
experimental: {
serverSourceMaps: false,
webpackBuildWorker: true,
},
webpack: (
config,
{ buildId, dev, isServer, defaultLoaders, nextRuntime, webpack },
) => {
config.cache = false;
return config;
},
};

export default withBundleAnalyzer(nextConfig);

vague vigilBOT
#

Hi @oak ether. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Based on the knowledge sources provided, there are several issues reported by users regarding slow compilation times in Next.js, particularly in development mode. Here are some potential solutions and considerations:

  1. Tailwind CSS Misconfiguration: If you're using Tailwind CSS, a misconfiguration in the content section could cause a significant slowdown. This isn't specific to Next.js and would cause problems in any application. Make sure your Tailwind CSS configuration is correct. Source (https://github.com/vercel/next.js/issues/48748)

  2. Large Client-Side Components: There are reports of significant build slowdowns when using large client-side components. If you're using large components, consider optimizing them or breaking them down into smaller components. Source (https://github.com/vercel/next.js/issues/58601)

  3. Webpack Configuration: You might want to review your Webpack configuration. In your provided Next.js configuration, you have config.cache = false; which disables caching. This could potentially slow down your builds as Webpack won't be able to use cached modules from previous builds. Source (https://github.com/vercel/next.js/issues/44430)

  4. Next.js Version: Some users reported a significant increase in build times after upgrading to Next.js version 14.x.y. If possible, you might want to consider downgrading to a previous version (like 13.4.9) to see if it improves your build times. Source (https://github.com/vercel/next.js/issues/58601)

  5. Monorepo Structure: If you're using a monorepo structure, there could be some issues related to that causing the slowdown. Source (https://github.com/vercel/next.js/issues/29559)

#

Please note that these are potential solutions and might not directly solve your issue. It's recommended to profile your build process to identify the exact cause of the slowdown.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: