/ next.config.js
next.config.js
 1  // eslint-disable-next-line
 2  const withBundleAnalyzer = require('@next/bundle-analyzer')({
 3    enabled: process.env.ANALYZE === 'true',
 4  });
 5  
 6  const pageExtensions = ['page.tsx', 'ts'];
 7  if (process.env.NEXT_PUBLIC_ENABLE_GOVERNANCE === 'true') pageExtensions.push('governance.tsx');
 8  if (process.env.NEXT_PUBLIC_ENABLE_STAKING === 'true') pageExtensions.push('staking.tsx');
 9  
10  /** @type {import('next').NextConfig} */
11  module.exports = withBundleAnalyzer({
12    webpack(config) {
13      config.module.rules.push({
14        test: /\.svg$/i,
15        issuer: /\.[jt]sx?$/,
16        use: [
17          {
18            loader: '@svgr/webpack',
19            options: {
20              svgoConfig: {
21                plugins: ['prefixIds'],
22              },
23            },
24          },
25        ],
26      });
27      config.experiments = {
28        topLevelAwait: true,
29        layers: true, // added for next api routes rpc proxy
30      };
31      config.resolve.fallback = { fs: false, net: false, tls: false };
32      return config;
33    },
34    reactStrictMode: true,
35    // assetPrefix: "./",
36    trailingSlash: true,
37    pageExtensions,
38    // NOTE: Needed for SAFE testing locally
39    // async headers() {
40    //   return [
41    //     {
42    //       source: '/manifest.json',
43    //       headers: [
44    //         {
45    //           key: 'Access-Control-Allow-Origin',
46    //           value: '*',
47    //         },
48    //         {
49    //           key: 'Access-Control-Allow-Methods',
50    //           value: 'GET',
51    //         },
52    //         {
53    //           key: 'Access-Control-Allow-Headers',
54    //           value: 'X-Requested-With, content-type, Authorization',
55    //         },
56    //       ],
57    //     },
58    //   ];
59    // },
60  });