Browse Source

remove unneccesary changes

Abhinav 3 years ago
parent
commit
061320914b
1 changed files with 21 additions and 62 deletions
  1. 21 62
      next.config.js

+ 21 - 62
next.config.js

@@ -3,7 +3,7 @@ const withBundleAnalyzer = require('@next/bundle-analyzer')({
 });
 const withWorkbox = require('@ente-io/next-with-workbox');
 
-// const { withSentryConfig } = require('@sentry/nextjs');
+const { withSentryConfig } = require('@sentry/nextjs');
 
 const cp = require('child_process');
 const gitSha = cp.execSync('git rev-parse --short HEAD', {
@@ -11,65 +11,24 @@ const gitSha = cp.execSync('git rev-parse --short HEAD', {
     encoding: 'utf8',
 });
 
-const { createSecureHeaders } = require('next-secure-headers');
-const { SubresourceIntegrityPlugin } = require('webpack-subresource-integrity');
-
-module.exports = withWorkbox(
-    // withSentryConfig(
-    withBundleAnalyzer({
-        env: {
-            SENTRY_RELEASE: gitSha,
-        },
-        workbox: {
-            swSrc: 'src/serviceWorker.js',
-            exclude: [/manifest\.json$/i],
-        },
-
-        // added header for local testing only as they are not exported with the app
-        headers() {
-            return [
-                {
-                    // Apply these headers to all routes in your application....
-                    source: '/(.*)',
-                    headers: [
-                        ...createSecureHeaders({
-                            contentSecurityPolicy: {
-                                directives: {
-                                    defaultSrc: "'none'",
-                                    imgSrc: "'self' blob:",
-                                    styleSrc: "'self' 'unsafe-inline'",
-                                    fontSrc: "'self'",
-                                    scriptSrc: "'self' 'unsafe-eval'",
-                                    connectSrc:
-                                        "'self' https://api.ente.io data:",
-                                    reportURI:
-                                        'https://csp-reporter.ente.workers.dev',
-                                    reportTo:
-                                        'https://csp-reporter.ente.workers.dev',
-                                },
-                            },
-                        }),
-                    ],
-                },
-            ];
-        },
-        // https://dev.to/marcinwosinek/how-to-add-resolve-fallback-to-webpack-5-in-nextjs-10-i6j
-        webpack: (config, { isServer }) => {
-            if (!isServer) {
-                config.resolve.fallback.fs = false;
-
-                config.output.crossOriginLoading = 'anonymous';
-                config.plugins = config.plugins || [];
-                config.plugins.push(
-                    new SubresourceIntegrityPlugin({
-                        hashFuncNames: ['sha256', 'sha384'],
-                        enabled: true,
-                    })
-                );
-            }
-            return config;
-        },
-    })
+module.exports = withSentryConfig(
+    withWorkbox(
+        withBundleAnalyzer({
+            env: {
+                SENTRY_RELEASE: gitSha,
+            },
+            workbox: {
+                swSrc: 'src/serviceWorker.js',
+                exclude: [/manifest\.json$/i],
+            },
+            // https://dev.to/marcinwosinek/how-to-add-resolve-fallback-to-webpack-5-in-nextjs-10-i6j
+            webpack: (config, { isServer }) => {
+                if (!isServer) {
+                    config.resolve.fallback.fs = false;
+                }
+                return config;
+            },
+        })
+    ),
+    { release: gitSha }
 );
-/* { release: gitSha }
-);*/