import type { NextConfig } from 'next';

const config: NextConfig = {
  reactStrictMode: true,

  // Workspace packages ship TypeScript source rather than a build artifact, so
  // Next compiles them as part of the app. Keeps the dev loop fast and avoids a
  // build step between editing a component and seeing it.
  transpilePackages: ['@i-learned/ui', '@i-learned/core', '@i-learned/db'],

  // The Prisma client must stay a real Node module rather than being bundled;
  // it loads a native query engine at runtime.
  serverExternalPackages: ['@prisma/client', '@node-rs/argon2'],

  typescript: {
    // Type errors fail the build. `pnpm typecheck` runs the same check in CI.
    ignoreBuildErrors: false,
  },
  // No remote images: every uploaded document is served through a signed,
  // authorized download route, never as a public asset (SPEC.md §25).
  images: { remotePatterns: [] },

  poweredByHeader: false,
};

export default config;
