import type { NextConfig } from 'next'; import path from 'node:path'; const nextConfig: NextConfig = { reactStrictMode: true, poweredByHeader: false, agentRules: false, // Workspace packages are consumed as TypeScript sources. transpilePackages: ['@rareindex/shared', '@rareindex/database', '@rareindex/taxonomy', '@rareindex/connectors'], serverExternalPackages: ['postgres', 'pino', 'cheerio'], images: { remotePatterns: [{ protocol: 'https', hostname: '**' }], formats: ['image/avif', 'image/webp'], }, experimental: { optimizePackageImports: ['lucide-react'], // Workspace packages use NodeNext-style `./file.js` imports that resolve to .ts sources. // Turbopack does not rewrite these outside the app root, so the app is built with webpack // (`next dev/build --webpack`) where extensionAlias handles the mapping. extensionAlias: { '.js': ['.ts', '.tsx', '.js'], '.mjs': ['.mts', '.mjs'] }, }, outputFileTracingRoot: path.resolve(__dirname, '../..'), async headers() { return [ { source: '/(.*)', headers: [ { key: 'X-Content-Type-Options', value: 'nosniff' }, { key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' }, { key: 'X-Frame-Options', value: 'SAMEORIGIN' }, { key: 'Permissions-Policy', value: 'camera=(self), microphone=(), geolocation=()' }, ], }, ]; }, }; export default nextConfig;