Add next.config.js
This commit is contained in:
73
next.config.js
Normal file
73
next.config.js
Normal file
@@ -0,0 +1,73 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
// Enable SWC minification for smaller bundle
|
||||
swcMinify: true,
|
||||
|
||||
// Enable experimental optimizations
|
||||
experimental: {
|
||||
optimizePackageImports: [
|
||||
'lucide-react',
|
||||
'@/components',
|
||||
'@/providers'
|
||||
]
|
||||
},
|
||||
|
||||
// Image optimization
|
||||
images: {
|
||||
formats: ['image/webp', 'image/avif'],
|
||||
remotePatterns: [
|
||||
{
|
||||
protocol: 'http',
|
||||
hostname: 'img.b2bpic.net'
|
||||
},
|
||||
{
|
||||
protocol: 'https',
|
||||
hostname: '**'
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// Enable compression
|
||||
compress: true,
|
||||
|
||||
// Optimize production builds
|
||||
productionBrowserSourceMaps: false,
|
||||
|
||||
// Generate static analysis
|
||||
webpack: (config, { isServer }) => {
|
||||
if (!isServer) {
|
||||
config.optimization = {
|
||||
...config.optimization,
|
||||
runtimeChunk: 'single',
|
||||
splitChunks: {
|
||||
chunks: 'all',
|
||||
cacheGroups: {
|
||||
default: false,
|
||||
vendors: false,
|
||||
lucide: {
|
||||
test: /[\\/]node_modules[\\/](lucide-react)[\\/]/,
|
||||
name: 'lucide',
|
||||
priority: 10,
|
||||
reuseExistingChunk: true
|
||||
},
|
||||
react: {
|
||||
test: /[\\/]node_modules[\\/](react|react-dom)[\\/]/,
|
||||
name: 'react',
|
||||
priority: 20,
|
||||
reuseExistingChunk: true
|
||||
},
|
||||
common: {
|
||||
minChunks: 2,
|
||||
priority: 5,
|
||||
reuseExistingChunk: true,
|
||||
name: 'common'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
return config;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = nextConfig;
|
||||
Reference in New Issue
Block a user