/** @type {import('next').NextConfig} */
const { version } = require('./package.json');

const nextConfig = {
  output: 'standalone',
  eslint: {
    ignoreDuringBuilds: true,
  },
  typescript: {
    ignoreBuildErrors: true,
  },
  optimizeFonts: false,
  env: {
    NEXT_PUBLIC_APP_VERSION: version,
  },
  experimental: {
    serverComponentsExternalPackages: ['ical.js', 'tsdav'],
  },
  webpack: (config, { isServer }) => {
    // Ignore .md files in node_modules (fixes apple-icloud README.md parse error)
    config.module.rules.push({
      test: /\.md$/,
      include: /node_modules/,
      type: 'asset/source',
    });
    return config;
  },
};

module.exports = nextConfig;
