From f7b2b16ab2f6599ea9c3dcbdd9e47af0999b4cb6 Mon Sep 17 00:00:00 2001
From: Ahmad <103906421+ahmadk953@users.noreply.github.com>
Date: Mon, 9 Dec 2024 18:58:19 -0500
Subject: [PATCH] Small Updates
---
app/global-error.tsx | 27 ++++++++
next.config.ts | 66 +++++++++++---------
package.json | 1 +
yarn.lock | 144 ++++++++++++++++++++++++++++++++++++++++++-
4 files changed, 207 insertions(+), 31 deletions(-)
create mode 100644 app/global-error.tsx
diff --git a/app/global-error.tsx b/app/global-error.tsx
new file mode 100644
index 0000000..912ad36
--- /dev/null
+++ b/app/global-error.tsx
@@ -0,0 +1,27 @@
+'use client';
+
+import * as Sentry from '@sentry/nextjs';
+import NextError from 'next/error';
+import { useEffect } from 'react';
+
+export default function GlobalError({
+ error,
+}: {
+ error: Error & { digest?: string };
+}) {
+ useEffect(() => {
+ Sentry.captureException(error);
+ }, [error]);
+
+ return (
+
+
+ {/* `NextError` is the default Next.js error page component. Its type
+ definition requires a `statusCode` prop. However, since the App Router
+ does not expose status codes for errors, we simply pass 0 to render a
+ generic error message. */}
+
+
+
+ );
+}
diff --git a/next.config.ts b/next.config.ts
index 43b1b15..bc531b0 100644
--- a/next.config.ts
+++ b/next.config.ts
@@ -8,6 +8,7 @@ const nextConfig: NextConfig = {
experimental: {
reactCompiler: true,
mdxRs: true,
+ webpackMemoryOptimizations: true,
},
images: {
remotePatterns: [
@@ -25,45 +26,50 @@ const nextConfig: NextConfig = {
};
const withMDX = createMDX({});
+const withBundleAnalyzer = require('@next/bundle-analyzer')({
+ enabled: process.env.ANALYZE === 'true',
+});
export default withContentCollections(
- withSentryConfig(withMDX(nextConfig), {
- // For all available options, see:
- // https://github.com/getsentry/sentry-webpack-plugin#options
+ withBundleAnalyzer(
+ withSentryConfig(withMDX(nextConfig), {
+ // For all available options, see:
+ // https://github.com/getsentry/sentry-webpack-plugin#options
- org: 'ahmadk953',
- project: 'tasko',
+ org: 'ahmadk953',
+ project: 'tasko',
- // Only print logs for uploading source maps in CI
- silent: !process.env.CI,
+ // Only print logs for uploading source maps in CI
+ silent: !process.env.CI,
- // For all available options, see:
- // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
+ // For all available options, see:
+ // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
- // Upload a larger set of source maps for prettier stack traces (increases build time)
- widenClientFileUpload: true,
+ // Upload a larger set of source maps for prettier stack traces (increases build time)
+ widenClientFileUpload: true,
- // Automatically annotate React components to show their full name in breadcrumbs and session replay
- reactComponentAnnotation: {
- enabled: true,
- },
+ // Automatically annotate React components to show their full name in breadcrumbs and session replay
+ reactComponentAnnotation: {
+ enabled: true,
+ },
- // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
- // This can increase your server load as well as your hosting bill.
- // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
- // side errors will fail.
- tunnelRoute: '/monitoring',
+ // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
+ // This can increase your server load as well as your hosting bill.
+ // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
+ // side errors will fail.
+ tunnelRoute: '/monitoring',
- // Hides source maps from generated client bundles
- hideSourceMaps: true,
+ // Hides source maps from generated client bundles
+ hideSourceMaps: true,
- // Automatically tree-shake Sentry logger statements to reduce bundle size
- disableLogger: true,
+ // Automatically tree-shake Sentry logger statements to reduce bundle size
+ disableLogger: true,
- // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
- // See the following for more information:
- // https://docs.sentry.io/product/crons/
- // https://vercel.com/docs/cron-jobs
- automaticVercelMonitors: true,
- })
+ // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)
+ // See the following for more information:
+ // https://docs.sentry.io/product/crons/
+ // https://vercel.com/docs/cron-jobs
+ automaticVercelMonitors: true,
+ })
+ )
);
diff --git a/package.json b/package.json
index e3d7ab2..b519b22 100644
--- a/package.json
+++ b/package.json
@@ -19,6 +19,7 @@
"@liveblocks/react": "^2.13.2",
"@mdx-js/loader": "^3.1.0",
"@mdx-js/react": "^3.1.0",
+ "@next/bundle-analyzer": "^15.0.4",
"@next/mdx": "^15.0.3",
"@prisma/client": "^6.0.1",
"@prisma/extension-accelerate": "^1.2.1",
diff --git a/yarn.lock b/yarn.lock
index cbb73c9..55cc06e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -427,6 +427,13 @@ __metadata:
languageName: node
linkType: hard
+"@discoveryjs/json-ext@npm:0.5.7":
+ version: 0.5.7
+ resolution: "@discoveryjs/json-ext@npm:0.5.7"
+ checksum: 10c0/e10f1b02b78e4812646ddf289b7d9f2cb567d336c363b266bd50cd223cf3de7c2c74018d91cd2613041568397ef3a4a2b500aba588c6e5bd78c38374ba68f38c
+ languageName: node
+ linkType: hard
+
"@emnapi/runtime@npm:^1.2.0":
version: 1.3.1
resolution: "@emnapi/runtime@npm:1.3.1"
@@ -1472,6 +1479,15 @@ __metadata:
languageName: node
linkType: hard
+"@next/bundle-analyzer@npm:^15.0.4":
+ version: 15.0.4
+ resolution: "@next/bundle-analyzer@npm:15.0.4"
+ dependencies:
+ webpack-bundle-analyzer: "npm:4.10.1"
+ checksum: 10c0/cbeddac527697faee19de87a84ff2b2a3a9986562ef4986b255c219d51eb78277350a63219472eaf6754183c2c9e8208139cbb2949d9c5aed7a37b07893554a2
+ languageName: node
+ linkType: hard
+
"@next/env@npm:15.0.4":
version: 15.0.4
resolution: "@next/env@npm:15.0.4"
@@ -2394,6 +2410,13 @@ __metadata:
languageName: node
linkType: hard
+"@polka/url@npm:^1.0.0-next.24":
+ version: 1.0.0-next.28
+ resolution: "@polka/url@npm:1.0.0-next.28"
+ checksum: 10c0/acc5ea62597e4da2fb42dbee02749d07f102ae7d6d2c966bf7e423c79cd65d1621da305af567e6e7c232f3b565e242d1ec932cbb3dcc0db1508d02e9a2cafa2e
+ languageName: node
+ linkType: hard
+
"@prisma/client@npm:^6.0.1":
version: 6.0.1
resolution: "@prisma/client@npm:6.0.1"
@@ -4169,7 +4192,16 @@ __metadata:
languageName: node
linkType: hard
-"acorn@npm:^8.0.0, acorn@npm:^8.11.2, acorn@npm:^8.14.0, acorn@npm:^8.8.1, acorn@npm:^8.8.2, acorn@npm:^8.9.0":
+"acorn-walk@npm:^8.0.0":
+ version: 8.3.4
+ resolution: "acorn-walk@npm:8.3.4"
+ dependencies:
+ acorn: "npm:^8.11.0"
+ checksum: 10c0/76537ac5fb2c37a64560feaf3342023dadc086c46da57da363e64c6148dc21b57d49ace26f949e225063acb6fb441eabffd89f7a3066de5ad37ab3e328927c62
+ languageName: node
+ linkType: hard
+
+"acorn@npm:^8.0.0, acorn@npm:^8.0.4, acorn@npm:^8.11.0, acorn@npm:^8.11.2, acorn@npm:^8.14.0, acorn@npm:^8.8.1, acorn@npm:^8.8.2, acorn@npm:^8.9.0":
version: 8.14.0
resolution: "acorn@npm:8.14.0"
bin:
@@ -5124,6 +5156,13 @@ __metadata:
languageName: node
linkType: hard
+"commander@npm:^7.2.0":
+ version: 7.2.0
+ resolution: "commander@npm:7.2.0"
+ checksum: 10c0/8d690ff13b0356df7e0ebbe6c59b4712f754f4b724d4f473d3cc5b3fdcf978e3a5dc3078717858a2ceb50b0f84d0660a7f22a96cdc50fb877d0c9bb31593d23a
+ languageName: node
+ linkType: hard
+
"commander@npm:^8.3.0":
version: 8.3.0
resolution: "commander@npm:8.3.0"
@@ -5327,6 +5366,13 @@ __metadata:
languageName: node
linkType: hard
+"debounce@npm:^1.2.1":
+ version: 1.2.1
+ resolution: "debounce@npm:1.2.1"
+ checksum: 10c0/6c9320aa0973fc42050814621a7a8a78146c1975799b5b3cc1becf1f77ba9a5aa583987884230da0842a03f385def452fad5d60db97c3d1c8b824e38a8edf500
+ languageName: node
+ linkType: hard
+
"debug@npm:2.6.9":
version: 2.6.9
resolution: "debug@npm:2.6.9"
@@ -5634,6 +5680,13 @@ __metadata:
languageName: node
linkType: hard
+"duplexer@npm:^0.1.2":
+ version: 0.1.2
+ resolution: "duplexer@npm:0.1.2"
+ checksum: 10c0/c57bcd4bdf7e623abab2df43a7b5b23d18152154529d166c1e0da6bee341d84c432d157d7e97b32fecb1bf3a8b8857dd85ed81a915789f550637ed25b8e64fc2
+ languageName: node
+ linkType: hard
+
"eastasianwidth@npm:^0.2.0":
version: 0.2.0
resolution: "eastasianwidth@npm:0.2.0"
@@ -7286,6 +7339,15 @@ __metadata:
languageName: node
linkType: hard
+"gzip-size@npm:^6.0.0":
+ version: 6.0.0
+ resolution: "gzip-size@npm:6.0.0"
+ dependencies:
+ duplexer: "npm:^0.1.2"
+ checksum: 10c0/4ccb924626c82125897a997d1c84f2377846a6ef57fbee38f7c0e6b41387fba4d00422274440747b58008b5d60114bac2349c2908e9aba55188345281af40a3f
+ languageName: node
+ linkType: hard
+
"has-bigints@npm:^1.0.2":
version: 1.0.2
resolution: "has-bigints@npm:1.0.2"
@@ -7807,6 +7869,13 @@ __metadata:
languageName: node
linkType: hard
+"html-escaper@npm:^2.0.2":
+ version: 2.0.2
+ resolution: "html-escaper@npm:2.0.2"
+ checksum: 10c0/208e8a12de1a6569edbb14544f4567e6ce8ecc30b9394fcaa4e7bb1e60c12a7c9a1ed27e31290817157e8626f3a4f29e76c8747030822eb84a6abb15c255f0a0
+ languageName: node
+ linkType: hard
+
"html-void-elements@npm:^2.0.0":
version: 2.0.1
resolution: "html-void-elements@npm:2.0.1"
@@ -10612,6 +10681,13 @@ __metadata:
languageName: node
linkType: hard
+"mrmime@npm:^2.0.0":
+ version: 2.0.0
+ resolution: "mrmime@npm:2.0.0"
+ checksum: 10c0/312b35ed288986aec90955410b21ed7427fd1e4ee318cb5fc18765c8d029eeded9444faa46589e5b1ed6b35fb2054a802ac8dcb917ddf6b3e189cb3bf11a965c
+ languageName: node
+ linkType: hard
+
"ms@npm:2.0.0":
version: 2.0.0
resolution: "ms@npm:2.0.0"
@@ -10988,6 +11064,15 @@ __metadata:
languageName: node
linkType: hard
+"opener@npm:^1.5.2":
+ version: 1.5.2
+ resolution: "opener@npm:1.5.2"
+ bin:
+ opener: bin/opener-bin.js
+ checksum: 10c0/dd56256ab0cf796585617bc28e06e058adf09211781e70b264c76a1dbe16e90f868c974e5bf5309c93469157c7d14b89c35dc53fe7293b0e40b4d2f92073bc79
+ languageName: node
+ linkType: hard
+
"optionator@npm:^0.9.3":
version: 0.9.4
resolution: "optionator@npm:0.9.4"
@@ -12808,6 +12893,17 @@ __metadata:
languageName: node
linkType: hard
+"sirv@npm:^2.0.3":
+ version: 2.0.4
+ resolution: "sirv@npm:2.0.4"
+ dependencies:
+ "@polka/url": "npm:^1.0.0-next.24"
+ mrmime: "npm:^2.0.0"
+ totalist: "npm:^3.0.0"
+ checksum: 10c0/68f8ee857f6a9415e9c07a1f31c7c561df8d5f1b1ba79bee3de583fa37da8718def5309f6b1c6e2c3ef77de45d74f5e49efc7959214443aa92d42e9c99180a4e
+ languageName: node
+ linkType: hard
+
"smart-buffer@npm:^4.2.0":
version: 4.2.0
resolution: "smart-buffer@npm:4.2.0"
@@ -13388,6 +13484,7 @@ __metadata:
"@mdx-js/loader": "npm:^3.1.0"
"@mdx-js/react": "npm:^3.1.0"
"@microsoft/eslint-formatter-sarif": "npm:^3.1.0"
+ "@next/bundle-analyzer": "npm:^15.0.4"
"@next/eslint-plugin-next": "npm:15.0.4"
"@next/mdx": "npm:^15.0.3"
"@prisma/client": "npm:^6.0.1"
@@ -13532,6 +13629,13 @@ __metadata:
languageName: node
linkType: hard
+"totalist@npm:^3.0.0":
+ version: 3.0.1
+ resolution: "totalist@npm:3.0.1"
+ checksum: 10c0/4bb1fadb69c3edbef91c73ebef9d25b33bbf69afe1e37ce544d5f7d13854cda15e47132f3e0dc4cafe300ddb8578c77c50a65004d8b6e97e77934a69aa924863
+ languageName: node
+ linkType: hard
+
"tr46@npm:~0.0.3":
version: 0.0.3
resolution: "tr46@npm:0.0.3"
@@ -14310,6 +14414,29 @@ __metadata:
languageName: node
linkType: hard
+"webpack-bundle-analyzer@npm:4.10.1":
+ version: 4.10.1
+ resolution: "webpack-bundle-analyzer@npm:4.10.1"
+ dependencies:
+ "@discoveryjs/json-ext": "npm:0.5.7"
+ acorn: "npm:^8.0.4"
+ acorn-walk: "npm:^8.0.0"
+ commander: "npm:^7.2.0"
+ debounce: "npm:^1.2.1"
+ escape-string-regexp: "npm:^4.0.0"
+ gzip-size: "npm:^6.0.0"
+ html-escaper: "npm:^2.0.2"
+ is-plain-object: "npm:^5.0.0"
+ opener: "npm:^1.5.2"
+ picocolors: "npm:^1.0.0"
+ sirv: "npm:^2.0.3"
+ ws: "npm:^7.3.1"
+ bin:
+ webpack-bundle-analyzer: lib/bin/analyzer.js
+ checksum: 10c0/6a94c8f6aa03296fb2eb00d6ad3b27bd5c551590fd253772bc61debf3177414d42701014079d4f85c74ba1ca685ae9f0cb4063812b58c21f294d108e9908e5cd
+ languageName: node
+ linkType: hard
+
"webpack-sources@npm:^3.2.3":
version: 3.2.3
resolution: "webpack-sources@npm:3.2.3"
@@ -14451,6 +14578,21 @@ __metadata:
languageName: node
linkType: hard
+"ws@npm:^7.3.1":
+ version: 7.5.10
+ resolution: "ws@npm:7.5.10"
+ peerDependencies:
+ bufferutil: ^4.0.1
+ utf-8-validate: ^5.0.2
+ peerDependenciesMeta:
+ bufferutil:
+ optional: true
+ utf-8-validate:
+ optional: true
+ checksum: 10c0/bd7d5f4aaf04fae7960c23dcb6c6375d525e00f795dd20b9385902bd008c40a94d3db3ce97d878acc7573df852056ca546328b27b39f47609f80fb22a0a9b61d
+ languageName: node
+ linkType: hard
+
"ws@npm:^8.18.0":
version: 8.18.0
resolution: "ws@npm:8.18.0"