import { Config } from '@remotion/cli/config';
import { enableTailwind } from '@remotion/tailwind';
import path from 'path';

Config.overrideWebpackConfig((currentConfig) => {
    const withTailwind = enableTailwind(currentConfig);

    return {
        ...withTailwind,
        resolve: {
            ...withTailwind.resolve,
            alias: {
                ...(withTailwind.resolve?.alias ?? {}),
                '@/src': path.resolve(process.cwd(), 'src'),
                '@/components': path.resolve(process.cwd(), 'src/components'),
                '@': path.resolve(process.cwd()),
                // Mock next/link
                'next/link': path.resolve(process.cwd(), 'video/components/NextLinkMock.tsx'),
            },
        },
    };
});

Config.setVideoImageFormat('jpeg');
Config.setCodec('h264');
