2023-12-08 22:35:15 +01:00
// Importing env files here to validate on build
2025-01-14 19:03:38 +01:00
import "@homarr/auth/env" ;
import "@homarr/db/env" ;
import "@homarr/common/env" ;
2025-02-18 22:54:15 +01:00
import "@homarr/log/env" ;
2025-01-22 20:43:54 +01:00
import "@homarr/docker/env" ;
2024-08-29 22:25:51 +02:00
2025-01-06 19:59:25 +01:00
import type { NextConfig } from "next" ;
2024-08-29 22:25:51 +02:00
import MillionLint from "@million/lint" ;
2024-10-26 22:46:14 +02:00
import createNextIntlPlugin from "next-intl/plugin" ;
2024-08-29 22:25:51 +02:00
2024-10-26 22:46:14 +02:00
// Package path does not work... so we need to use relative path
2025-03-12 18:37:43 +01:00
const withNextIntl = createNextIntlPlugin ( {
experimental : {
createMessagesDeclaration : "../../packages/translation/src/lang/en.json" ,
} ,
requestConfig : "../../packages/translation/src/request.ts" ,
} ) ;
2024-10-26 22:46:14 +02:00
2025-01-06 19:59:25 +01:00
const nextConfig : NextConfig = {
2024-03-16 15:51:34 +01:00
output : "standalone" ,
2023-12-08 22:35:15 +01:00
reactStrictMode : true ,
/** We already do linting and typechecking as separate tasks in CI */
eslint : { ignoreDuringBuilds : true } ,
typescript : { ignoreBuildErrors : true } ,
2025-06-07 16:19:09 +02:00
/ * *
* dockerode is required in the external server packages because of https : //github.com/homarr-labs/homarr/issues/612
* /
serverExternalPackages : [ "dockerode" ] ,
2023-12-09 00:32:45 +01:00
experimental : {
2024-05-19 22:38:39 +02:00
optimizePackageImports : [ "@mantine/core" , "@mantine/hooks" , "@tabler/icons-react" ] ,
2023-12-09 00:32:45 +01:00
} ,
2024-05-19 22:38:39 +02:00
transpilePackages : [ "@homarr/ui" , "@homarr/notifications" , "@homarr/modals" , "@homarr/spotlight" , "@homarr/widgets" ] ,
2024-01-02 17:12:26 +01:00
images : {
domains : [ "cdn.jsdelivr.net" ] ,
} ,
2025-05-23 22:19:59 +02:00
// eslint-disable-next-line @typescript-eslint/require-await,no-restricted-syntax
async headers() {
return [
{
source : "/(.*)" , // Apply CSP to all routes
headers : [
{
key : "Content-Security-Policy" ,
2025-09-06 12:29:30 +02:00
// worker-src / media-src with blob: is necessary for video.js, see https://github.com/homarr-labs/homarr/issues/3912 and https://stackoverflow.com/questions/65792855/problem-with-video-js-and-content-security-policy-csp
2025-05-23 22:19:59 +02:00
value : `
default - src 'self' ;
script - src * 'unsafe-inline' 'unsafe-eval' ;
2025-09-06 12:29:30 +02:00
worker - src * blob : ;
2025-05-23 22:19:59 +02:00
base - uri 'self' ;
connect - src * ;
2025-06-06 19:58:37 +02:00
style - src * 'unsafe-inline' ;
2025-05-23 22:19:59 +02:00
frame - ancestors * ;
frame - src * ;
form - action 'self' ;
img - src * data : ;
2025-05-25 16:39:20 +02:00
font - src * data : ;
2025-09-06 12:29:30 +02:00
media - src * data : blob : ;
2025-05-23 22:19:59 +02:00
`
. replace ( /\s{2,}/g , " " )
. trim ( ) ,
} ,
] ,
} ,
] ;
} ,
2023-12-08 22:35:15 +01:00
} ;
2024-08-29 22:25:51 +02:00
// Skip transform is used because of webpack loader, without it for example 'Tooltip.Floating' will not work and show an error
2025-01-06 19:59:25 +01:00
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2024-08-29 22:25:51 +02:00
const withMillionLint = MillionLint . next ( { rsc : true , skipTransform : true , telemetry : false } ) ;
2024-10-26 22:46:14 +02:00
export default withNextIntl ( nextConfig ) ;