-
Notifications
You must be signed in to change notification settings - Fork 31
/
next.config.js
70 lines (62 loc) · 2.13 KB
/
next.config.js
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
// workaround for ESM module loader errors
// see https://github.com/vercel/next.js/issues/25454
const { withSentryConfig } = require('@sentry/nextjs')
const withTM = require('next-transpile-modules')([
'react-markdown',
'@solana/wallet-adapter-base',
'@solana/wallet-adapter-phantom',
'@solana/wallet-adapter-sollet',
])
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
})
let config
// STEP 1: Add transpiler.
config = withTM({
webpack: (config, { isServer }) => {
config.experiments = { asyncWebAssembly: true, layers: true }
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack'],
})
if (!isServer) config.resolve.fallback.fs = false
return config
},
pageExtensions: ['mdx', 'md', 'jsx', 'tsx', 'api.ts'], // .ts files are not pages
reactStrictMode: true,
productionBrowserSourceMaps: true,
env: {
MAIN_VIEW_SHOW_MAX_TOP_TOKENS_NUM:
process.env.MAIN_VIEW_SHOW_MAX_TOP_TOKENS_NUM,
DISABLE_NFTS: process.env.DISABLE_NFTS,
REALM: process.env.REALM,
MAINNET_RPC: process.env.MAINNET_RPC,
DEVNET_RPC: process.env.DEVNET_RPC,
DEFAULT_GOVERNANCE_PROGRAM_ID: process.env.DEFAULT_GOVERNANCE_PROGRAM_ID,
},
//proxy for openserum api cors
rewrites: async () => {
return [
{
source: '/openSerumApi/:path*',
destination: 'https://openserum.io/api/serum/:path*',
},
]
},
})
// STEP 2: Enable bundle analyzer when `ANALYZE=true`.
config = withBundleAnalyzer(config)
if (process.env.SENTRY_AUTH_TOKEN) {
// STEP 3: Sentry error reporting. MUST COME LAST to work with sourcemaps.
config = withSentryConfig(config, {
// Additional config options for the Sentry Webpack plugin. Keep in mind that
// the following options are set automatically, and overriding them is not
// recommended:
// release, url, org, project, authToken, configFile, stripPrefix,
// urlPrefix, include, ignore
silent: true, // Suppresses all logs
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options.
})
}
module.exports = config