photos/next.config.js
Michael Mainguy b4b248925f Fix docs page layout and suppress Swagger UI React warnings
- Create ConditionalLayout component to exclude sidebar from /docs routes
- Replace direct MainLayout usage in root layout with route-based conditional rendering
- Implement SwaggerUIWrapper component to suppress React strict mode warnings
- Add comprehensive console warning filtering for UNSAFE lifecycle methods
- Update webpack configuration to ignore third-party component warnings
- Install string-replace-loader for enhanced warning suppression
- Maintain full API documentation functionality while providing clean console output

Fixes issue where docs page showed unwanted sidebar and resolves console warnings from swagger-ui-react components using deprecated React lifecycle methods.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-27 19:54:48 -05:00

35 lines
1013 B
JavaScript

/** @type {import('next').NextConfig} */
const nextConfig = {
images: {
formats: ['image/webp', 'image/avif'],
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
// Allow local patterns for our API
localPatterns: [
{
pathname: '/api/photos/**',
}
]
},
// Suppress React strict mode warnings for third-party components
webpack: (config, { dev, isServer }) => {
if (dev) {
// Suppress specific warnings from swagger-ui-react in development
config.ignoreWarnings = [
...(config.ignoreWarnings || []),
/UNSAFE_componentWillReceiveProps/,
/componentWillReceiveProps/,
/UNSAFE_componentWillMount/,
/componentWillMount/,
/UNSAFE_componentWillUpdate/,
/componentWillUpdate/,
/strict mode is not recommended/,
/ModelCollapse/,
/OperationContainer/,
]
}
return config
},
}
module.exports = nextConfig