Files
biblical-guide.com/next.config.js
Andrei fb4959a550 Exclude /bibles/ and /scripts/ folders from Next.js builds
Major performance optimization:
- Completely exclude /bibles/ (7GB+) and /scripts/ directories from webpack processing
- Add watchOptions to ignore these directories during development
- Install ignore-loader to skip large data files
- Update .nextignore with comprehensive exclusion patterns
- This should reduce build memory usage from 15GB to ~2-4GB

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-24 08:16:22 +00:00

72 lines
1.6 KiB
JavaScript

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: {
// Reduce memory usage during builds
webpackBuildWorker: true,
// Use SWC minifier (faster than Terser)
swcMinify: true,
},
// 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/**',
'**/.git/**',
'**/.next/**'
]
}
// Add ignore patterns for webpack
config.module.rules.push({
test: /bibles\/.*\.(json|txt|md)$/,
use: 'ignore-loader'
})
// 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)