const withNextIntl = require('next-intl/plugin')('./i18n.ts'); /** @type {import('next').NextConfig} */ const nextConfig = { typedRoutes: false, trailingSlash: false, poweredByHeader: false, compress: true, // Build optimizations experimental: { // Disable webpack build worker to prevent memory issues webpackBuildWorker: false, }, // Webpack optimizations webpack: (config, { dev, isServer }) => { if (!dev) { // Production optimizations config.optimization = { ...config.optimization, // Limit concurrent chunks to reduce memory usage splitChunks: { ...config.optimization.splitChunks, maxAsyncRequests: 6, maxInitialRequests: 4, }, } } // Exclude large directories from webpack processing config.watchOptions = { ...config.watchOptions, ignored: [ '**/node_modules/**', '**/bibles/**', '**/scripts/**', '**/csv_bibles/**', '**/*.csv', '**/.git/**', '**/.next/**' ] } // Add ignore patterns for webpack - exclude entire directories and CSV files config.module.rules.push({ test: /[\\/](bibles|scripts|csv_bibles)[\\/]/, use: 'ignore-loader' }) // Ignore CSV files specifically config.module.rules.push({ test: /\.csv$/, use: 'ignore-loader' }) // Also exclude these paths from resolve config.resolve = { ...config.resolve, alias: { ...config.resolve?.alias, // Prevent webpack from trying to resolve these directories '@/bibles': false, '@/scripts': false } } // Reduce bundle analysis overhead config.stats = 'errors-warnings' return config }, // Reduce build memory usage onDemandEntries: { maxInactiveAge: 25 * 1000, pagesBufferLength: 2, }, // Exclude large static files from processing pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'md'], // Ignore large directories during builds async rewrites() { return [] }, } module.exports = withNextIntl(nextConfig)