sharenet/frontend/next.config.ts

62 lines
1.4 KiB
TypeScript

import type { NextConfig } from "next";
const nextConfig: NextConfig = {
// Performance optimizations
compress: true,
// Enable experimental features for better performance
experimental: {
// Enable optimized package imports
optimizePackageImports: ['lucide-react', '@radix-ui/react-dialog', '@radix-ui/react-label'],
},
// Turbopack configuration (moved from experimental)
turbopack: {
rules: {
'*.svg': {
loaders: ['@svgr/webpack'],
as: '*.js',
},
},
},
// Webpack optimizations
webpack: (config, { dev, isServer }) => {
// Optimize bundle size
if (!dev && !isServer) {
config.optimization = {
...config.optimization,
splitChunks: {
chunks: 'all',
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: 'vendors',
chunks: 'all',
},
},
},
};
}
return config;
},
// Image optimization
images: {
formats: ['image/webp', 'image/avif'],
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
},
// Enable static optimization
trailingSlash: false,
poweredByHeader: false,
// Compiler optimizations
compiler: {
removeConsole: process.env.NODE_ENV === 'production',
},
};
export default nextConfig;