-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
133 lines (111 loc) · 3.17 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
/** @type {import('next').NextConfig} */
// TODO: Enable import { resourcesPathMap } from @app/config/paths/resources.d
const paths = [
// PAGES
'/me/stores',
'/me/stores/:id',
'/me/redemptions',
'/admin/dash',
'/admin/customers',
'/admin/redemption_history',
'/admin/products',
'/admin/credits',
// API
'/api/users/me/stores',
'/api/users/me/redemptions',
//api/users/me/credits
'/api/stores/me/customers',
'/api/stores/me/customers/:id',
'/api/stores/me/redemptions',
'/api/stores/me/redemptions/:id',
'/api/stores/me/products',
'/api/stores/me/products/:id',
'/api/stores/me/credits',
'/api/stores/me/settings',
'/api/stores/me/settings/:id',
'/api/stores',
'/api/stores/:id',
'/api/stores/:id/products',
];
const resourcesPathMap = [
{source: '/redemption_history', destination: '/orders'},
{source: '/redemptions', destination: '/orders'},
{source: '/stores', destination: '/organizations'},
{source: '/my_store', destination: '/my_organization'},
{source: '/customers', destination: '/clients'},
]
const nextConfig = {
reactStrictMode: false,
compiler: {
styledComponents: {
displayName: true,
ssr: true,
fileName: true,
cssProp: true,
namespace: "boilerplate",
},
},
images: {
remotePatterns: [
{
protocol: 'https',
hostname: '*.googleusercontent.com',
},
{
protocol: 'https',
hostname: '*.kempinski.com',
},
{
protocol: 'https',
hostname: '*.cloudfront.net',
},
{
protocol: 'https',
hostname: '*.timeout.com',
},
{
protocol: 'https',
hostname: 'loremflickr.com',
},
],
},
// https://nextjs.org/docs/pages/api-reference/next-config-js/rewrites
async rewrites() {
const list = paths.map((source) => {
let destination = source;
for (const pathMap of resourcesPathMap) {
destination = destination.replace(pathMap.source, pathMap.destination)
}
return { source, destination }
})
return list;
},
}
module.exports = nextConfig
// Injected content via Sentry wizard below
const { withSentryConfig } = require("@sentry/nextjs");
module.exports = withSentryConfig(
module.exports,
{
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options
// Suppresses source map uploading logs during build
silent: true,
org: "loyaltyme",
project: "javascript-nextjs",
},
{
// 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",
// Hides source maps from generated client bundles
hideSourceMaps: true,
// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,
}
);