-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathnext.config.js
More file actions
111 lines (104 loc) · 2.99 KB
/
next.config.js
File metadata and controls
111 lines (104 loc) · 2.99 KB
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
'use strict';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const dns = require('dns');
dns.setDefaultResultOrder('ipv4first');
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('./src/lib/plugins/index.js');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const withMDX = require('@next/mdx')({
extension: /\.(md|mdx)$/,
options: {
remarkPlugins: [],
rehypePlugins: [],
},
});
const isDev = process.env.NODE_ENV === 'development';
// Next configuration with support for rewrting API to existing common services
const nextConfig = {
output: 'standalone',
serverRuntimeConfig: {
HOSTNAME: '0.0.0.0',
},
env: {
version: process.env.npm_package_version,
},
reactStrictMode: true,
pageExtensions: ['mdx', 'md', 'jsx', 'js', 'tsx', 'ts'],
basePath: process.env.BASE_PATH || '',
transpilePackages: ['@gen3/core', '@gen3/frontend'],
webpack: (config) => {
config.infrastructureLogging = {
level: 'error',
};
return config;
},
async rewrites() {
if (isDev) {
const GEN3_TARGET =
process.env.NEXT_PUBLIC_GEN3_API_TARGET || 'https://localhost';
return [
{ source: '/_status', destination: `${GEN3_TARGET}/_status` },
{ source: '/user/:path*', destination: `${GEN3_TARGET}/user/:path*` },
{
source: '/guppy/:path*',
destination: `${GEN3_TARGET}/guppy/:path*`,
},
{ source: '/mds/:path*', destination: `${GEN3_TARGET}/mds/:path*` },
{
source: '/ai-search/:path*',
destination: `${GEN3_TARGET}/ai-search/:path*`,
},
{
source: '/authz/:path*',
destination: `${GEN3_TARGET}/authz/:path*`,
},
{
source: '/lw-workspace/:path*',
destination: `${GEN3_TARGET}/lw-workspace/:path*`,
},
{
source: '/api/v0/submission/:path*',
destination: `${GEN3_TARGET}/api/v0/submission/:path*`,
},
{ source: '/wts/:path*', destination: `${GEN3_TARGET}/wts/:path*` },
{
source: '/library/lists/:path*',
destination: `${GEN3_TARGET}/library/lists/:path*`,
},
{ source: '/jobs/:path*', destination: `${GEN3_TARGET}/jobs/:path*` },
{
source: '/manifests/:path*',
destination: `${GEN3_TARGET}/manifests/:path*`,
},
{
source: '/requestor/:path*',
destination: `${GEN3_TARGET}/requestor/:path*`,
},
{
source: '/index/:path*',
destination: `${GEN3_TARGET}/index/:path*`,
},
{
source: '/login',
destination: `${GEN3_TARGET}/login`,
},
];
} else {
return [];
}
},
async headers() {
return [
{
source: '/(.*)?', // Matches all pages
headers: [
{
key: 'X-Frame-Options',
value: 'SAMEORIGIN',
},
],
},
];
},
};
module.exports = withMDX(nextConfig);