forked from Greenstand/treetracker-web-map-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
113 lines (111 loc) · 2.69 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
/* eslint-disable require-await */
const withImages = require('next-images');
module.exports = {
...withImages(),
images: {
domains: [
'treetracker-production-images.s3.eu-central-1.amazonaws.com',
'treetracker-dev-images.s3.eu-central-1.amazonaws.com',
'180.earth',
'purecatamphetamine.github.io',
'treetracker-production.nyc3.digitaloceanspaces.com',
],
disableStaticImages: true,
},
async rewrites() {
return [
{
source: '/planters/:planterId(\\d{1,})/trees/:treeId(\\d{1,})',
destination: '/trees/:treeId(\\d{1,})',
},
{
source:
'/organizations/:organizationId([0-9a-zA-Z-]{1,})/trees/:treeId(\\d{1,})',
destination: '/trees/:treeId(\\d{1,})',
},
{
source: '/wallets/:walletId([0-9a-zA-Z-]{1,})/tokens/:tokenId(.{36})',
destination: '/tokens/:tokenId([a-z0-9-]{36})',
},
{
source: '/map/:map_name(\\d{1,})',
destination: '/?map=:map_name',
},
{
source: '/wallets/:walletId([0-9a-zA-Z-]{1,})/tokens',
destination: '/tokens/idfromquery',
},
];
},
async redirects() {
return [
{
source: '/:path((?!trees).*)',
has: [
{
type: 'query',
key: 'treeid',
value: '(?<treeId>(\\d{1,}))',
},
],
destination: '/trees/:treeId(\\d{1,})',
permanent: true,
},
{
source: '/:path((?!planters).*)',
has: [
{
type: 'query',
key: 'userid',
value: '(?<planterId>(\\d{1,}))',
},
],
destination: '/planters/:planterId(\\d{1,})',
permanent: true,
},
{
source: '/:path((?!wallets).*)',
has: [
{
type: 'query',
key: 'wallet',
value: '(?<walletId>(\\w{1,}))',
},
],
destination: '/wallets/:walletId(\\d{1,})',
permanent: true,
},
];
},
basePath: process.env.NEXT_PUBLIC_BASE,
webpack(config) {
// console.log(
// 'next config object /n //////////////////////: /n',
// config,
// '/n//////////////////////////////',
// );
console.log(config.name, config.mode, config.devtool);
config.module.rules.push(
{
test: /\.svg$/i,
issuer: /\.[jt]sx?$/,
use: [
{
loader: '@svgr/webpack',
options: { icon: true },
},
],
},
{
test: /\.(png|jpg|gif)$/,
use: [
{
loader: 'url-loader',
options: {},
},
],
},
);
return config;
},
};