optimization
This commit is contained in:
@@ -5,8 +5,8 @@ const withBundleAnalyzer = bundleAnalyzer({ enabled: process.env.ANALYZE === 'tr
|
||||
/** @type {import('next').NextConfig} */
|
||||
const baseConfig = {
|
||||
output: 'standalone',
|
||||
reactStrictMode: false,
|
||||
compress: process.env.NODE_ENV === 'production',
|
||||
// Enable compression for better performance
|
||||
compress: true,
|
||||
images: {
|
||||
remotePatterns: [
|
||||
{
|
||||
@@ -58,10 +58,10 @@ const baseConfig = {
|
||||
transform: 'date-fns/{{member}}',
|
||||
},
|
||||
},
|
||||
// Webpack config (fallback if using --webpack flag)
|
||||
// Enhanced webpack config for better bundle splitting
|
||||
webpack: (config, { isServer, dev }) => {
|
||||
if (!isServer && !dev) {
|
||||
// Only apply aggressive code splitting in production
|
||||
// Enhanced code splitting for better performance
|
||||
config.optimization = {
|
||||
...config.optimization,
|
||||
moduleIds: 'deterministic',
|
||||
@@ -70,41 +70,62 @@ const baseConfig = {
|
||||
cacheGroups: {
|
||||
default: false,
|
||||
vendors: false,
|
||||
recharts: {
|
||||
test: /[\\/]node_modules[\\/]recharts[\\/]/,
|
||||
name: 'recharts',
|
||||
// Separate React and related libraries
|
||||
react: {
|
||||
test: /[\\/]node_modules[\\/](react|react-dom|scheduler)[\\/]/,
|
||||
name: 'react',
|
||||
chunks: 'all',
|
||||
priority: 30,
|
||||
priority: 50,
|
||||
enforce: true,
|
||||
},
|
||||
// Separate UI library components
|
||||
radix: {
|
||||
test: /[\\/]node_modules[\\/]@radix-ui[\\/]/,
|
||||
name: 'radix-ui',
|
||||
chunks: 'all',
|
||||
priority: 40,
|
||||
},
|
||||
// Separate charting libraries
|
||||
charts: {
|
||||
test: /[\\/]node_modules[\\/](recharts|d3-.*)[\\/]/,
|
||||
name: 'charts',
|
||||
chunks: 'all',
|
||||
priority: 35,
|
||||
},
|
||||
// Separate icon libraries
|
||||
icons: {
|
||||
test: /[\\/]node_modules[\\/]lucide-react[\\/]/,
|
||||
name: 'icons',
|
||||
chunks: 'all',
|
||||
priority: 30,
|
||||
},
|
||||
// Separate date utilities
|
||||
dateUtils: {
|
||||
test: /[\\/]node_modules[\\/]date-fns[\\/]/,
|
||||
name: 'date-utils',
|
||||
chunks: 'all',
|
||||
priority: 25,
|
||||
},
|
||||
reactMarkdown: {
|
||||
test: /[\\/]node_modules[\\/]react-markdown[\\/]/,
|
||||
name: 'react-markdown',
|
||||
// Separate form libraries
|
||||
forms: {
|
||||
test: /[\\/]node_modules[\\/](react-hook-form|@hookform)[\\/]/,
|
||||
name: 'forms',
|
||||
chunks: 'all',
|
||||
priority: 20,
|
||||
},
|
||||
dateFns: {
|
||||
test: /[\\/]node_modules[\\/]date-fns[\\/]/,
|
||||
name: 'date-fns',
|
||||
// Group remaining vendor libraries
|
||||
vendor: {
|
||||
test: /[\\/]node_modules[\\/]/,
|
||||
name: 'vendor',
|
||||
chunks: 'all',
|
||||
priority: 15,
|
||||
},
|
||||
framework: {
|
||||
name: 'framework',
|
||||
chunks: 'all',
|
||||
test: /[\\/]node_modules[\\/](react|react-dom|scheduler)[\\/]/,
|
||||
priority: 40,
|
||||
priority: 10,
|
||||
enforce: true,
|
||||
},
|
||||
commons: {
|
||||
name: 'commons',
|
||||
minChunks: 2,
|
||||
priority: 10,
|
||||
// Common application code
|
||||
common: {
|
||||
name: 'common',
|
||||
minChunks: 3,
|
||||
priority: 5,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -112,10 +133,6 @@ const baseConfig = {
|
||||
}
|
||||
return config;
|
||||
},
|
||||
onDemandEntries: {
|
||||
maxInactiveAge: 15 * 1000,
|
||||
pagesBufferLength: 2,
|
||||
},
|
||||
productionBrowserSourceMaps: false,
|
||||
typescript: {
|
||||
ignoreBuildErrors: true,
|
||||
|
||||
Reference in New Issue
Block a user