39948-vm/frontend/next.config.mjs

52 lines
1.1 KiB
JavaScript

/**
* @type {import('next').NextConfig}
*/
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import withSerwistInit from '@serwist/next';
const output = process.env.NEXT_OUTPUT || undefined;
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const isDevelopment = process.env.NODE_ENV === 'development';
// Configure Serwist for production service worker generation.
const withSerwist = withSerwistInit({
swSrc: 'src/sw.ts',
swDest: 'public/sw.js',
disable: isDevelopment,
maximumFileSizeToCacheInBytes: 5 * 1024 * 1024,
});
const nextConfig = {
trailingSlash: true,
distDir: isDevelopment ? '.next' : 'build',
outputFileTracingRoot: __dirname,
output,
basePath: '',
devIndicators: {
position: 'bottom-left',
},
typescript: {
ignoreBuildErrors: false,
},
eslint: {
ignoreDuringBuilds: false,
},
images: {
unoptimized: true,
remotePatterns: [
{
protocol: 'https',
hostname: '**',
},
],
localPatterns: [
{
pathname: '/api/**',
},
],
},
};
export default isDevelopment ? nextConfig : withSerwist(nextConfig);