2023-10-20 10:54:20 +00:00
|
|
|
const nextBuildId = require("next-build-id");
|
2023-11-13 03:41:29 +00:00
|
|
|
const { withSentryConfig } = require("@sentry/nextjs");
|
2023-11-13 05:42:06 +00:00
|
|
|
const withBundleAnalyzer = require("@next/bundle-analyzer")({ enabled: false });
|
2023-11-13 07:39:54 +00:00
|
|
|
const InfisicalClient = require("infisical-node");
|
|
|
|
|
|
|
|
const infisicalClient = new InfisicalClient({
|
|
|
|
token: process.env.INFISICAL_TOKEN,
|
|
|
|
siteURL: "https://secrets.fascinated.cc",
|
|
|
|
});
|
2023-11-13 05:42:06 +00:00
|
|
|
|
|
|
|
// Define remote patterns for images
|
|
|
|
const remotePatterns = [
|
|
|
|
{ protocol: "https", hostname: "cdn.fascinated.cc", pathname: "/**" },
|
|
|
|
{ protocol: "https", hostname: "cdn.scoresaber.com", pathname: "/**" },
|
|
|
|
{ protocol: "https", hostname: "cdn.jsdelivr.net", pathname: "/**" },
|
|
|
|
{ protocol: "https", hostname: "eu.cdn.beatsaver.com", pathname: "/**" },
|
|
|
|
{ protocol: "https", hostname: "na.cdn.beatsaver.com", pathname: "/**" },
|
|
|
|
{
|
|
|
|
protocol: "https",
|
|
|
|
hostname: "avatars.akamai.steamstatic.com",
|
|
|
|
pathname: "/**",
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
// Define optimized package imports
|
|
|
|
const optimizePackageImports = [
|
|
|
|
"react",
|
|
|
|
"react-dom",
|
|
|
|
"next-themes",
|
|
|
|
"react-tostify",
|
|
|
|
"websocket",
|
|
|
|
"cslx",
|
|
|
|
"chart.js",
|
|
|
|
"react-chartjs-2",
|
|
|
|
"country-list",
|
|
|
|
"@sentry/nextjs",
|
|
|
|
];
|
2023-10-20 10:54:20 +00:00
|
|
|
|
2023-10-18 06:58:40 +00:00
|
|
|
/** @type {import('next').NextConfig} */
|
2023-10-19 04:21:35 +00:00
|
|
|
const nextConfig = {
|
2023-10-19 13:17:55 +00:00
|
|
|
generateEtags: true,
|
2023-11-08 11:49:19 +00:00
|
|
|
reactStrictMode: true,
|
|
|
|
swcMinify: true,
|
2023-11-13 05:42:06 +00:00
|
|
|
compress: false,
|
|
|
|
poweredByHeader: false,
|
2023-11-08 11:49:19 +00:00
|
|
|
experimental: {
|
|
|
|
webpackBuildWorker: true,
|
2023-11-13 05:42:06 +00:00
|
|
|
optimizePackageImports,
|
2023-11-08 11:49:19 +00:00
|
|
|
},
|
2023-10-20 10:54:20 +00:00
|
|
|
env: {
|
2023-10-20 11:00:41 +00:00
|
|
|
NEXT_PUBLIC_BUILD_ID:
|
|
|
|
process.env.GIT_REV || nextBuildId.sync({ dir: __dirname }),
|
2023-11-06 17:40:54 +00:00
|
|
|
NEXT_PUBLIC_BUILD_TIME: new Date().toLocaleDateString("en-US", {
|
|
|
|
year: "numeric",
|
|
|
|
month: "long",
|
|
|
|
day: "numeric",
|
|
|
|
hour: "numeric",
|
|
|
|
minute: "numeric",
|
|
|
|
}),
|
2023-10-20 10:54:20 +00:00
|
|
|
},
|
2023-11-13 05:42:06 +00:00
|
|
|
images: { remotePatterns },
|
2023-10-19 04:21:35 +00:00
|
|
|
};
|
2023-10-18 06:58:40 +00:00
|
|
|
|
2023-11-13 05:42:06 +00:00
|
|
|
module.exports = async () =>
|
|
|
|
withSentryConfig(
|
|
|
|
withBundleAnalyzer(nextConfig),
|
|
|
|
{
|
|
|
|
silent: true,
|
|
|
|
org: "sentry",
|
|
|
|
project: "scoresaber-reloaded",
|
|
|
|
url: "https://sentry.fascinated.cc",
|
|
|
|
authToken: (await infisicalClient.getSecret("SENTRY_AUTH_TOKEN"))
|
|
|
|
.secretValue,
|
|
|
|
dryRun: process.env.NODE_ENV !== "development",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
widenClientFileUpload: false,
|
|
|
|
transpileClientSDK: false,
|
|
|
|
tunnelRoute: "/monitoring",
|
|
|
|
hideSourceMaps: true,
|
|
|
|
disableLogger: true,
|
|
|
|
},
|
|
|
|
);
|