| Server IP : 35.80.110.71 / Your IP : 216.73.216.221 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/smart-home-nextjs/current/ |
Upload File : |
import type { NextConfig } from "next";
import { withSentryConfig } from "@sentry/nextjs";
import withPWA from "@ducanh2912/next-pwa";
const nextConfig: NextConfig = {
/* config options here */
reactCompiler: true,
};
// PWA configuration
const pwaConfig = withPWA({
dest: "public",
disable: process.env.NODE_ENV === "development",
register: true,
fallbacks: {
document: "/offline",
},
cacheOnFrontEndNav: true,
aggressiveFrontEndNavCaching: true,
reloadOnOnline: true,
workboxOptions: {
skipWaiting: true,
clientsClaim: true,
runtimeCaching: [
{
urlPattern: /^https:\/\/fonts\.(?:gstatic|googleapis)\.com\/.*/i,
handler: "CacheFirst",
options: {
cacheName: "google-fonts",
expiration: {
maxEntries: 10,
maxAgeSeconds: 365 * 24 * 60 * 60, // 1 year
},
},
},
{
urlPattern: /\.(?:eot|otf|ttc|ttf|woff|woff2)$/i,
handler: "StaleWhileRevalidate",
options: {
cacheName: "static-font-assets",
expiration: {
maxEntries: 10,
maxAgeSeconds: 7 * 24 * 60 * 60, // 1 week
},
},
},
{
urlPattern: /\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,
handler: "StaleWhileRevalidate",
options: {
cacheName: "static-image-assets",
expiration: {
maxEntries: 64,
maxAgeSeconds: 30 * 24 * 60 * 60, // 30 days
},
},
},
{
urlPattern: /\/_next\/image\?url=.+$/i,
handler: "StaleWhileRevalidate",
options: {
cacheName: "next-image",
expiration: {
maxEntries: 64,
maxAgeSeconds: 24 * 60 * 60, // 24 hours
},
},
},
{
urlPattern: /\.(?:js)$/i,
handler: "StaleWhileRevalidate",
options: {
cacheName: "static-js-assets",
expiration: {
maxEntries: 32,
maxAgeSeconds: 24 * 60 * 60, // 24 hours
},
},
},
{
urlPattern: /\.(?:css)$/i,
handler: "StaleWhileRevalidate",
options: {
cacheName: "static-style-assets",
expiration: {
maxEntries: 32,
maxAgeSeconds: 24 * 60 * 60, // 24 hours
},
},
},
{
urlPattern: /\/_next\/data\/.+\/.+\.json$/i,
handler: "StaleWhileRevalidate",
options: {
cacheName: "next-data",
expiration: {
maxEntries: 32,
maxAgeSeconds: 24 * 60 * 60, // 24 hours
},
},
},
{
urlPattern: /\/api\/.*$/i,
handler: "NetworkFirst",
options: {
cacheName: "apis",
networkTimeoutSeconds: 10,
expiration: {
maxEntries: 16,
maxAgeSeconds: 24 * 60 * 60, // 24 hours
},
},
},
{
urlPattern: /.*/i,
handler: "NetworkFirst",
options: {
cacheName: "others",
networkTimeoutSeconds: 10,
expiration: {
maxEntries: 32,
maxAgeSeconds: 24 * 60 * 60, // 24 hours
},
},
},
],
},
});
// Sentry configuration
const sentryConfig = {
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
// Only print logs for uploading source maps in CI
silent: !process.env.CI,
// Upload source maps for better error tracking
widenClientFileUpload: true,
// Route segment performance instrumentation
tunnelRoute: "/monitoring",
// Source maps configuration
sourcemaps: {
deleteSourcemapsAfterUpload: true,
},
// Webpack configuration
bundleSizeOptimizations: {
excludeDebugStatements: true,
excludeReplayIframe: true,
excludeReplayShadowDom: true,
},
};
// Apply PWA config first, then Sentry
export default withSentryConfig(pwaConfig(nextConfig), sentryConfig);