Files
QR-master/next.config.mjs
2026-07-10 21:52:36 +02:00

169 lines
6.2 KiB
JavaScript

import os from 'os';
import path from 'path';
function isWslOnWindowsMount() {
return process.platform === 'linux' && process.cwd().startsWith('/mnt/');
}
/** @type {import('next').NextConfig} */
const nextConfig = {
output: 'standalone',
skipTrailingSlashRedirect: true,
eslint: {
ignoreDuringBuilds: true,
},
images: {
unoptimized: false,
remotePatterns: [
{ protocol: 'https', hostname: 'www.qrmaster.net' },
{ protocol: 'https', hostname: 'qrmaster.net' },
{ protocol: 'https', hostname: 'images.qrmaster.net' },
],
formats: ['image/webp', 'image/avif'],
deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],
imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],
},
experimental: {
serverComponentsExternalPackages: ['@prisma/client', 'bcryptjs'],
},
// Allow build to succeed even with prerender errors
// Pages with useSearchParams() will be rendered dynamically at runtime
staticPageGenerationTimeout: 120,
onDemandEntries: {
maxInactiveAge: 25 * 1000,
pagesBufferLength: 2,
},
poweredByHeader: false,
webpack: (config, { dev }) => {
if (!dev && isWslOnWindowsMount()) {
config.cache = {
type: 'filesystem',
cacheDirectory: path.join(os.tmpdir(), 'qrmaster-next-webpack-cache'),
};
}
return config;
},
async headers() {
const longCacheHeaders = [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
];
return [
{ source: '/favicon1.png', headers: longCacheHeaders },
{ source: '/favicon.svg', headers: longCacheHeaders },
{ source: '/favicon.ico', headers: longCacheHeaders },
{ source: '/logo.svg', headers: longCacheHeaders },
{ source: '/producthunt-featured.svg', headers: longCacheHeaders },
];
},
async redirects() {
return [
// German home lives at /qr-code-erstellen (established ranking page);
// /de only hosts the German subpages.
{
source: '/de',
destination: '/qr-code-erstellen',
permanent: true,
},
// SEO Cannibalization Redirects
{
source: '/dynamic-barcode-generator',
destination: '/tools/barcode-generator',
permanent: true,
},
{
source: '/barcode-generator',
destination: '/tools/barcode-generator',
permanent: true,
},
{
source: '/blog/qr-code-analytics',
destination: '/qr-code-analytics',
permanent: true,
},
{
source: '/use-cases/restaurant-menu-qr-codes',
destination: '/restaurants',
permanent: true,
},
{
source: '/blog/qr-code-restaurant-menu',
destination: '/restaurants',
permanent: true,
},
{
source: '/create-qr',
destination: '/dynamic-qr-code-generator',
permanent: true,
},
{
source: '/guide/tracking-analytics',
destination: '/learn/tracking',
permanent: true,
},
{
source: '/guide/bulk-qr-code-generation',
destination: '/learn/developer',
permanent: true,
},
{
source: '/guide/qr-code-best-practices',
destination: '/learn/basics',
permanent: true,
},
{
source: '/tools/phone-qr-code',
destination: '/tools/call-qr-code-generator',
permanent: true,
},
{
source: '/qr-code-for/breweries-tap-rooms',
destination: '/qr-code-for/breweries',
permanent: true,
},
{
source: '/qr-code-for/wineries-vineyards',
destination: '/qr-code-for/wineries',
permanent: true,
},
{
source: '/qr-code-for/catering-businesses',
destination: '/qr-code-for/catering',
permanent: true,
},
{
source: '/qr-code-for/spas-wellness-centers',
destination: '/qr-code-for/spas',
permanent: true,
},
// Additional likely old slugs from previous site version
{ source: '/qr-code-for/bars-pubs', destination: '/qr-code-for/bars', permanent: true },
{ source: '/qr-code-for/nightclubs-venues', destination: '/qr-code-for/nightclubs', permanent: true },
{ source: '/qr-code-for/dental-practices', destination: '/qr-code-for/dentists', permanent: true },
{ source: '/qr-code-for/pet-groomers', destination: '/qr-code-for/pet-grooming', permanent: true },
{ source: '/qr-code-for/clothing-apparel-stores', destination: '/qr-code-for/clothing-stores', permanent: true },
{ source: '/qr-code-for/florists-flower-shops', destination: '/qr-code-for/florists', permanent: true },
{ source: '/qr-code-for/pet-stores-groomers', destination: '/qr-code-for/pet-stores', permanent: true },
{ source: '/qr-code-for/hardware-diy-stores', destination: '/qr-code-for/hardware-stores', permanent: true },
{ source: '/qr-code-for/universities-colleges', destination: '/qr-code-for/universities', permanent: true },
{ source: '/qr-code-for/museums-exhibitions', destination: '/qr-code-for/museums', permanent: true },
{ source: '/qr-code-for/public-libraries', destination: '/qr-code-for/libraries', permanent: true },
{ source: '/qr-code-for/theaters-performing-arts', destination: '/qr-code-for/theaters', permanent: true },
{ source: '/qr-code-for/cinemas-movie-theaters', destination: '/qr-code-for/cinemas', permanent: true },
{ source: '/qr-code-for/churches-places-of-worship', destination: '/qr-code-for/churches', permanent: true },
{ source: '/qr-code-for/stadiums-sports-venues', destination: '/qr-code-for/stadiums', permanent: true },
{ source: '/qr-code-for/airports-travel-hubs', destination: '/qr-code-for/airports', permanent: true },
{ source: '/qr-code-for/photography-studios', destination: '/qr-code-for/photographers', permanent: true },
{ source: '/qr-code-for/trade-shows-exhibitions', destination: '/qr-code-for/trade-shows', permanent: true },
{ source: '/qr-code-for/accounting-firms', destination: '/qr-code-for/accountants', permanent: true },
];
},
};
export default nextConfig;