forked from manifoldmarkets/manifold
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
154 lines (152 loc) · 3.56 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
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
const API_DOCS_URL = 'https://docs.manifold.markets/api'
/** @type {import('next').NextConfig} */
module.exports = {
productionBrowserSourceMaps: true,
reactStrictMode: true,
optimizeFonts: false,
modularizeImports: {
'@heroicons/react/solid/?(((\\w*)?/?)*)': {
transform: '@heroicons/react/solid/{{ matches.[1] }}/{{member}}',
},
'@heroicons/react/outline/?(((\\w*)?/?)*)': {
transform: '@heroicons/react/outline/{{ matches.[1] }}/{{member}}',
},
lodash: {
transform: 'lodash/{{member}}',
},
},
transpilePackages: ['common'],
experimental: {
scrollRestoration: true,
},
images: {
dangerouslyAllowSVG: true,
domains: [
'manifold.markets',
'lh3.googleusercontent.com',
'i.imgur.com',
'firebasestorage.googleapis.com',
'storage.googleapis.com',
'picsum.photos',
'media.giphy.com',
'media0.giphy.com',
'media1.giphy.com',
'media2.giphy.com',
'media3.giphy.com',
'media4.giphy.com',
'media5.giphy.com',
'media6.giphy.com',
],
},
webpack: (config) => {
config.module.rules.push({
test: /\.svg$/,
use: [
{
loader: '@svgr/webpack',
options: {
svgoConfig: {
plugins: [{ name: 'removeViewBox', active: false }],
floatPrecision: 2,
},
},
},
],
})
return config
},
async redirects() {
return [
{
source: '/api',
destination: API_DOCS_URL,
permanent: false,
},
{
source: '/api/v0',
destination: API_DOCS_URL,
permanent: false,
},
{
source: '/analytics',
destination: '/stats',
permanent: true,
},
{
source: '/labs',
destination: '/about',
permanent: true,
},
{
source: '/sitemap',
destination: '/about',
permanent: false,
},
{
source: '/versus',
destination: '/VersusBot?tab=markets',
permanent: false,
},
{
source: '/privacy',
destination: '/privacy.html',
permanent: true,
},
{
source: '/terms',
destination: '/terms.html',
permanent: true,
},
{
source: '/umami',
destination:
'https://analytics.umami.is/share/ARwUIC9GWLNyowjq/Manifold%20Markets',
permanent: false,
},
{
source: '/this-month',
destination: '/markets?f=closing-this-month&s=most-popular',
permanent: true,
},
{
source: '/markets',
destination: '/browse',
permanent: true,
},
{
source: '/search',
destination: '/browse',
permanent: true,
},
{
source: '/groups',
destination: '/browse',
permanent: true,
},
{
source: '/group/:slug*',
destination: '/browse?topic=:slug*',
permanent: true,
},
{
source: '/questions:slug*',
has: [
{
type: 'query',
key: 'topic',
// Using a named capture group to capture the value of 'topic'
value: '(?<slug>.*)',
},
],
permanent: true,
destination: '/browse?topic=:slug', // Using the captured value here
},
{
source: '/questions',
destination: '/browse',
permanent: true,
},
// NOTE: add any external redirects at common/envs/constants.ts and update native apps.
]
},
}