-
Notifications
You must be signed in to change notification settings - Fork 48
/
next.config.js
146 lines (138 loc) · 3.87 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
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
});
const { redirectJobs, redirectDocs, redirectPages } = require('./lib/redirects');
const nextConfig = {
experimental: {
scrollRestoration: true,
forceSwcTransforms: true,
},
compiler: {
styledComponents: true,
},
images: { formats: ['image/webp'] },
publicRuntimeConfig: {
auth0: {
issuerBaseHost: process.env.AUTH0_ISSUER_BASE_HOST,
clientId: process.env.AUTH0_CLIENT_ID,
baseUrl: process.env.AUTH0_BASE_URL,
audience: process.env.AUTH0_AUDIENCE,
},
},
headers: async () => {
return [
{
// Apply these headers to all routes
source: "/(.*)",
headers: [
{
key: "Content-Security-Policy",
value: "frame-ancestors 'self'",
},
],
},
];
},
redirects: async () => [
{
source: '/blog/redpanda_connect_w_ockam',
destination: '/blog/redpanda_connect_with_ockam',
permanent: true,
},
{
source: '/download',
destination: '/get-started',
permanent: true,
},
{
source: '/signup',
destination: '/auth/signup',
permanent: true,
},
{
source: '/signin',
destination: '/get-started',
permanent: true,
},
{
source: '/learn/guides/team/values_and_virtues_on_the_Ockam_Team',
destination: '/mission',
permanent: true,
},
{
source: '/learn/how-to-guides/high-performance-team/engineering_levels',
destination: '/blog/levels_ladder',
permanent: true,
},
{
source: '/learn/blog/:slug*',
destination: '/blog/:slug*',
permanent: true,
},
{
source: '/open-source/:slug*',
destination: '/open-source',
permanent: true,
},
{
source: '/learn/blog/trust_influxdb/',
destination: '/blog/connect_private_influxdb',
permanent: true,
},
{
source: '/learn/how-to-guides/high-performance-team/values_and_virtues_on_the_Ockam_Team/',
destination: '/blog/high_performance_team',
permanent: true,
},
{
source: '/learn/guides/contributions/CONTRIBUTING',
destination:
'https://github.com/build-trust/.github/blob/main/CONTRIBUTING.md#contributing-to-ockam-on-github',
permanent: true,
},
{
source: '/learn/how-to-guides/contributing/CONTRIBUTING',
destination:
'https://github.com/build-trust/.github/blob/main/CONTRIBUTING.md#contributing-to-ockam-on-github',
permanent: true,
},
{
source: '/learn/how-to-guides/contributing/CONTRIBUTING/',
destination:
'https://github.com/build-trust/.github/blob/main/CONTRIBUTING.md#contributing-to-ockam-on-github',
permanent: true,
},
...redirectDocs,
...redirectJobs,
...redirectPages,
],
};
const svgconfig = {
webpack(config) {
// Grab the existing rule that handles SVG imports
const fileLoaderRule = config.module.rules.find((rule) => rule.test?.test?.('.svg'));
config.module.rules.push(
// Reapply the existing rule, but only for svg imports ending in ?url
{
...fileLoaderRule,
test: /\.svg$/i,
resourceQuery: /url/, // *.svg?url
},
// Convert all other *.svg imports to React components
{
test: /\.svg$/i,
// issuer: /\.[jt]sx?$/,
resourceQuery: { not: /url/ }, // exclude if *.svg?url
use: ['@svgr/webpack'],
},
);
// Modify the file loader rule to ignore *.svg, since we have it handled now.
fileLoaderRule.exclude = /\.svg$/i;
return config;
},
};
module.exports = { ...svgconfig, ...nextConfig };
// module.exports = (_phase, { defaultPlugin }) => {
// const plugins = [withBundleAnalyzer];
// return plugins.reduce((acc, plugin) => plugin(acc), { ...nextConfig });
// };