@@ -314,6 +314,21 @@ const securityHeadersConfig = (phase: string) => {
314314 ${ upgradeInsecure }
315315 `
316316
317+ // for production environment white-list vitals.vercel-insights
318+ // based on: https://vercel.com/docs/speed-insights#content-security-policy
319+ if ( process . env . VERCEL_ENV === 'production' ) {
320+ return `
321+ ${ defaultCSPDirectives }
322+ font-src 'self';
323+ style-src 'self' 'unsafe-inline';
324+ script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval';
325+ connect-src 'self' https://vitals.vercel-insights.com ${ reportingDomainWildcard } ;
326+ img-src 'self' data:;
327+ frame-src 'none';
328+ ${ reportCSPViolations }
329+ `
330+ }
331+
317332 // when environment is preview enable unsafe-inline scripts for vercel preview feedback/comments feature
318333 // and whitelist vercel's domains based on:
319334 // https://vercel.com/docs/workflow-collaboration/comments/specialized-usage#using-a-content-security-policy
@@ -332,26 +347,11 @@ const securityHeadersConfig = (phase: string) => {
332347 `
333348 }
334349
335- // for production environment white-list vitals.vercel-insights
336- // based on: https://vercel.com/docs/speed-insights#content-security-policy
337- if ( process . env . VERCEL_ENV === 'production' ) {
338- return `
339- ${ defaultCSPDirectives }
340- font-src 'self';
341- style-src 'self' 'unsafe-inline';
342- script-src 'self' 'unsafe-inline' 'wasm-unsafe-eval';
343- connect-src 'self' https://vitals.vercel-insights.com ${ reportingDomainWildcard } ;
344- img-src 'self' data:;
345- frame-src 'none';
346- ${ reportCSPViolations }
347- `
348- }
349-
350350 // for dev environment enable unsafe-eval for hot-reload
351351 return `
352352 ${ defaultCSPDirectives }
353- font-src 'self';
354- style-src 'self' 'unsafe-inline';
353+ font-src 'self' https://fonts.gstatic.com ;
354+ style-src 'self' 'unsafe-inline' https://fonts.googleapis.com ;
355355 script-src 'self' 'unsafe-inline' 'unsafe-eval' https://va.vercel-scripts.com;
356356 connect-src 'self';
357357 img-src 'self' data:;
@@ -432,14 +432,26 @@ export default withSentryConfig(
432432 enabled : false ,
433433 } ,
434434
435+ // TODO: enable as soon as @sentry /nextjs supports it
436+ // (and set the above reactComponentAnnotation to true)
437+ // https://github.com/getsentry/sentry-javascript/releases
438+ // ignore the "Canvas" component to avoid Sentry annotations
439+ // conflicts with react-three-fiber
440+ //ignoredComponents: ['Canvas'],
441+
435442 // Route browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.
436443 // This can increase your server load as well as your hosting bill.
437444 // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
438445 // side errors will fail.
439446 tunnelRoute : '/monitoring' ,
440447
441448 // Hides source maps from generated client bundles
442- hideSourceMaps : true ,
449+ sourcemaps : {
450+ //disable: false;
451+ //assets: string | string[];
452+ //ignore?: string | string[];
453+ //deleteSourcemapsAfterUpload: boolean;
454+ } ,
443455
444456 // Automatically tree-shake Sentry logger statements to reduce bundle size
445457 disableLogger : true ,
0 commit comments