This repository was archived by the owner on May 14, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnext.config.mjs
More file actions
183 lines (167 loc) · 6.07 KB
/
next.config.mjs
File metadata and controls
183 lines (167 loc) · 6.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/** @type {import('next').NextConfig} */
// eslint-disable-next-line prettier/prettier
import packageJson from "./package.json" with { type: "json" };
import "./scripts/download-blog-posts.data.json.mjs"
import { withSentryConfig } from "@sentry/nextjs"
const nextConfig = {
env: {
NEXT_PUBLIC_VERSION: packageJson.version,
NEXT_PUBLIC_FRONTENDS_URL: process.env.VERCEL_ENV === "production" ? "https://scroll.io" : process.env.VERCEL_BRANCH_URL?`https://${process.env.VERCEL_BRANCH_URL}`:"http://localhost:3000",
},
images: {
deviceSizes: [600, 900, 1200, 1536],
},
// trailingSlash: true,
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'X-Frame-Options',
value: 'DENY'
},
{
key: 'Content-Security-Policy',
value: "frame-ancestors 'none'"
}
]
}
]
},
// async redirects() {
// return [
// {
// source: "/developer-nft",
// destination: "/developer-nft/mint",
// permanent: true,
// },
// // blog
// { source: "/blog/scalingSecurity", destination: "/blog/scaling-security", permanent: true },
// { source: "/blog/founderLetter", destination: "/blog/founder-letter", permanent: true },
// { source: "/blog/scrollSepolia", destination: "/blog/scroll-sepolia", permanent: true },
// { source: "/blog/contributeToScroll", destination: "/blog/contribute-to-scroll", permanent: true },
// { source: "/blog/alphaTestnet", destination: "/blog/alpha-testnet", permanent: true },
// { source: "/blog/releaseNote0109", destination: "/blog/release-note-0109", permanent: true },
// { source: "/blog/proofGeneration", destination: "/blog/proof-generation", permanent: true },
// { source: "/blog/upgradingPreAlphaTestnet", destination: "/blog/upgrading-pre-alpha-testnet", permanent: true },
// { source: "/blog/technicalPrinciples", destination: "/blog/technical-principles", permanent: true },
// { source: "/blog/preAlphaTestnet", destination: "/blog/pre-alpha-testnet", permanent: true },
// { source: "/blog/visionAndValues", destination: "/blog/vision-and-values", permanent: true },
// { source: "/blog/scrollsFreshCoat", destination: "/blog/scrolls-fresh-coat", permanent: true },
// { source: "/sticker-vote", destination: "/sticker-winners", permanent: true },
// // { source: "/airdrop-faq", destination: "https://scroll-faqs.gitbook.io/faqs", permanent: false},
// ]
// },
// async rewrites() {
// return [
// {
// source: '/canvas/listing',
// destination: 'https://badge-registry.canvas.scroll.cat/badge-registry'
// },
// {
// source: '/badge-registry/:path*',
// destination: 'https://badge-registry.canvas.scroll.cat/badge-registry/:path*'
// },
// {
// source: '/gov-docs/:path*',
// destination: 'https://scroll-governance-documentation.vercel.app/:path*'
// }
// ]
// },
images: {
remotePatterns: [
{
protocol: "https",
hostname: "scroll-tech.github.io",
port: "",
pathname: "/token-list/data/**",
},
],
},
// eslint-disable-next-line
webpack: (config, { buildId, dev, isServer, defaultLoaders, nextRuntime, webpack }) => {
config.ignoreWarnings = [
function ignoreSourcemapsloaderWarnings(warning) {
return warning.module && warning.module.resource.includes("node_modules") && warning.details && warning.details.includes("source-map-loader")
},
]
// Grab the existing rule that handles SVG imports
const fileLoaderRule = config.module.rules.find(rule => rule.test?.test?.(".svg"))
config.module.rules.push(
...[
{
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto",
resolve: {
fullySpecified: false,
},
},
{
...fileLoaderRule,
test: /\.svg$/i,
resourceQuery: /url/, // *.svg?url
},
{
test: /\.svg$/i,
issuer: fileLoaderRule.issuer,
resourceQuery: { not: [...fileLoaderRule.resourceQuery.not, /url/] }, // exclude if *.svg?url
use: [
{
loader: "@svgr/webpack",
options: {
svgoConfig: {
plugins: [
{
name: "preset-default",
params: {
overrides: {
removeViewBox: false,
},
},
},
],
},
},
},
],
},
// .md
{
test: /\.md$/,
use: "raw-loader",
},
],
)
fileLoaderRule.exclude = /\.svg$/i
config.externals.push("pino-pretty", "lokijs", "encoding")
return config
},
sentry: {
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
// Upload a larger set of source maps for prettier stack traces (increases build time)
widenClientFileUpload: true,
// Transpiles SDK to be compatible with IE11 (increases bundle size)
transpileClientSDK: true,
// Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load)
// tunnelRoute: "/monitoring-tunnel",
// Hides source maps from generated client bundles
hideSourceMaps: true,
// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,
// Enables automatic instrumentation of Vercel Cron Monitors.
// See the following for more information:
// https://docs.sentry.io/product/crons/
// https://vercel.com/docs/cron-jobs
// automaticVercelMonitors: true,
},
}
// export default nextConfig
// Injected content via Sentry wizard below
export default withSentryConfig(nextConfig, {
silent: true,
org: "t1-lh",
project: "frontend-bridge",
});