Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,9 @@ out/

# ts build
tsconfig.tsbuildinfo

# Auto Generated PWA files
**/public/sw.js
**/public/workbox-*.js

certificates
161 changes: 88 additions & 73 deletions next.config.ts
Original file line number Diff line number Diff line change
@@ -1,81 +1,96 @@
import withPWA from 'next-pwa';
import { withSentryConfig } from "@sentry/nextjs";
import { NextConfig } from "next";
import { PHASE_PRODUCTION_BUILD } from "next/constants";

const nextConfig = (phase: string): NextConfig => ({
output: phase === PHASE_PRODUCTION_BUILD ? "export" : undefined,
trailingSlash: false,
reactStrictMode: true,
images: {
unoptimized: true,
},
headers:
export default (phase: string) => {

const nextConfig = (phase: string): NextConfig => ({
output: phase === PHASE_PRODUCTION_BUILD ? "export" : undefined,
trailingSlash: false,
reactStrictMode: true,
images: {
unoptimized: true,
},
});

const sentryConfig = withSentryConfig(nextConfig, {
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
org: process.env.SENTRY_ORG,
project: "javascript-nextjs",
widenClientFileUpload: true,
reactComponentAnnotation: {
enabled: true,
},
hideSourceMaps: true,
disableLogger: true,
});

const configWithPWA = withPWA({
dest: "public",
disable: false, // phase == PHASE_DEVELOPMENT_SERVER,
register: true,
skipWaiting: true,
})(sentryConfig);

configWithPWA.headers =
phase === PHASE_PRODUCTION_BUILD
? undefined
: async () => [
{
source: "/",
headers: [
{
key: "Cross-Origin-Embedder-Policy",
value: "require-corp",
},
{
key: "Cross-Origin-Opener-Policy",
value: "same-origin",
},
],
},
{
source: "/engines/:blob*",
headers: [
{
key: "Cross-Origin-Embedder-Policy",
value: "require-corp",
},
{
key: "Cross-Origin-Opener-Policy",
value: "same-origin",
},
],
},
{
source: "/play",
headers: [
{
key: "Cross-Origin-Embedder-Policy",
value: "require-corp",
},
{
key: "Cross-Origin-Opener-Policy",
value: "same-origin",
},
],
},
{
source: "/database",
headers: [
{
key: "Cross-Origin-Embedder-Policy",
value: "require-corp",
},
{
key: "Cross-Origin-Opener-Policy",
value: "same-origin",
},
],
},
],
});
{
source: "/",
headers: [
{
key: "Cross-Origin-Embedder-Policy",
value: "require-corp",
},
{
key: "Cross-Origin-Opener-Policy",
value: "same-origin",
},
],
},
{
source: "/engines/:blob*",
headers: [
{
key: "Cross-Origin-Embedder-Policy",
value: "require-corp",
},
{
key: "Cross-Origin-Opener-Policy",
value: "same-origin",
},
],
},
{
source: "/play",
headers: [
{
key: "Cross-Origin-Embedder-Policy",
value: "require-corp",
},
{
key: "Cross-Origin-Opener-Policy",
value: "same-origin",
},
],
},
{
source: "/database",
headers: [
{
key: "Cross-Origin-Embedder-Policy",
value: "require-corp",
},
{
key: "Cross-Origin-Opener-Policy",
value: "same-origin",
},
],
},
];

return configWithPWA;

export default withSentryConfig(nextConfig, {
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
org: process.env.SENTRY_ORG,
project: "javascript-nextjs",
widenClientFileUpload: true,
reactComponentAnnotation: {
enabled: true,
},
hideSourceMaps: true,
disableLogger: true,
});
};
Loading