Files
MananTank d7f2249fb1 [TOOL-3032] Next.js build memory optimizations (#5938)
* Disable eslint as part of next.js build - We are already running eslint in separate pipeline
* Enable Next.js memory optimization flags

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on enhancing the configuration of multiple `Next.js` applications by adding ESLint settings, production source maps, and experimental features. It also modifies security headers and refines the handling of IPFS gateways.

### Detailed summary
- Added `eslint` configuration with `ignoreDuringBuilds: true` to multiple `next.config` files.
- Set `productionBrowserSourceMaps` to `false`.
- Enabled experimental features: `webpackBuildWorker`, `webpackMemoryOptimizations`, and `serverSourceMaps`.
- Updated security headers in `apps/dashboard/next.config.ts` for consistent formatting.
- Refined `determineIpfsGateways` function for IPFS gateway handling.
- Maintained existing configurations for redirects, rewrites, images, and compiler settings.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
2025-01-14 09:46:30 +00:00

78 lines
1.7 KiB
JavaScript

const ContentSecurityPolicy = `
default-src 'self';
img-src * data: blob:;
media-src * data: blob:;
object-src 'none';
style-src 'self' 'unsafe-inline';
font-src 'self';
frame-src * data:;
script-src 'self' 'unsafe-eval' 'unsafe-inline' 'wasm-unsafe-eval' 'inline-speculation-rules' *.thirdweb.com *.thirdweb-dev.com vercel.live js.stripe.com;
connect-src * data: blob:;
worker-src 'self' blob:;
block-all-mixed-content;
`;
const securityHeaders = [
{
key: "X-DNS-Prefetch-Control",
value: "on",
},
{
key: "X-XSS-Protection",
value: "1; mode=block",
},
{
key: "X-Frame-Options",
value: "SAMEORIGIN",
},
{
key: "Referrer-Policy",
value: "origin-when-cross-origin",
},
{
key: "Content-Security-Policy",
value: ContentSecurityPolicy.replace(/\s{2,}/g, " ").trim(),
},
];
/** @type {import('next').NextConfig} */
const nextConfig = {
eslint: {
ignoreDuringBuilds: true,
},
productionBrowserSourceMaps: false,
experimental: {
webpackBuildWorker: true,
webpackMemoryOptimizations: true,
serverSourceMaps: false,
},
async headers() {
return [
{
source: "/(.*)",
headers: securityHeaders,
},
];
},
webpack: (config) => {
config.externals.push("pino-pretty", "lokijs", "encoding");
return config;
},
async redirects() {
return [
{
source: "/connect/sign-in",
destination: "/connect/sign-in/button",
permanent: false,
},
{
source: "/connect/account-abstraction",
destination: "/connect/account-abstraction/connect",
permanent: false,
},
];
},
};
export default nextConfig;