Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
feat: nextjs pwa
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiejaoude committed Nov 9, 2023
1 parent 6ef1e6a commit 293ada0
Show file tree
Hide file tree
Showing 121 changed files with 1,530 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/vercel-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
workflow_dispatch:
push:
branches:
- feat-custom-domain
- feat-pwa

jobs:
deploy:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ test-results/

# Sentry Auth Token
.sentryclirc

# PWA
public/sw.js*
public/workbox-*.js*
2 changes: 2 additions & 0 deletions components/PageHead.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export default function PageHead(props) {
<meta property="og:type" content={ogType} />
<meta property="og:url" content={ogUrl} />
<meta property="og:image" content={ogImage} />
<link rel="manifest" href="/manifest.json" />

{children}
</Head>
);
Expand Down
60 changes: 35 additions & 25 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import { withSentryConfig } from "@sentry/nextjs";
import remarkGfm from "remark-gfm";
import remarkPrism from "remark-prism";
import createMDX from "@next/mdx";
import withPWA from "next-pwa";
import runtimeCaching from "next-pwa/cache.js";

const isProduction = process.env.NODE_ENV === "production";

/** @type {import('next').NextConfig} */
const nextConfig = {
Expand Down Expand Up @@ -50,36 +54,42 @@ const withMDX = createMDX({
});

export default withSentryConfig(
withMDX(nextConfig),
{
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options
withPWA({
dest: "public",
disable: !isProduction,
runtimeCaching,
})(
withMDX(nextConfig),
{
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options

// Suppresses source map uploading logs during build
silent: true,
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
},
{
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
// Suppresses source map uploading logs during build
silent: true,
org: process.env.SENTRY_ORG,
project: process.env.SENTRY_PROJECT,
},
{
// 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,

// Transpiles SDK to be compatible with IE11 (increases bundle size)
transpileClientSDK: true,
// Transpiles SDK to be compatible with IE11 (increases bundle size)
transpileClientSDK: true,

// Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load)
tunnelRoute: "/monitoring",
// Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load)
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,

// custom
automaticVercelMonitors: false,
},
// custom
automaticVercelMonitors: false,
},
),
);
Loading

0 comments on commit 293ada0

Please sign in to comment.