This repository has been archived by the owner on Apr 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
71 lines (67 loc) · 3.01 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
// @ts-check
const path = require('path');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const withPlugins = require('next-compose-plugins');
const { patchWebpackConfig: patchForGlobalCSS } = require('next-global-css');
const withTranspileModules = require('next-transpile-modules')([]);
const ExtraWatchWebpackPlugin = require('extra-watch-webpack-plugin');
/**
* @type {import('next').NextConfig}
**/
module.exports = withPlugins([withTranspileModules], {
webpack: (config, options) => {
// These 'react' related configs are added to enable linking packages in development
// (e.g. Arranger), and not get the "broken Hooks" warning.
// https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react
if (options.isServer) {
config.externals = ['react', ...config.externals];
} else {
options.dev &&
config.plugins.push(new ForkTsCheckerWebpackPlugin()) &&
config.plugins.push(
new ExtraWatchWebpackPlugin({
dirs: [path.resolve(__dirname, '.', 'node_modules', 'react')],
}),
);
}
config.resolve.alias['@emotion/react'] = path.resolve(
__dirname,
'.',
'node_modules',
'@emotion/react',
);
config.resolve.alias['react'] = path.resolve(__dirname, '.', 'node_modules', 'react');
process.env.NODE_ENV === 'development' && (config.optimization.minimize = false);
return patchForGlobalCSS(config, options);
},
publicRuntimeConfig: {
NEXT_PUBLIC_UI_VERSION: process.env.npm_package_version,
NEXT_PUBLIC_EGO_API_ROOT: process.env.NEXT_PUBLIC_EGO_API_ROOT,
NEXT_PUBLIC_EGO_CLIENT_ID: process.env.NEXT_PUBLIC_EGO_CLIENT_ID,
EGO_PUBLIC_KEY: process.env.EGO_PUBLIC_KEY,
NEXT_PUBLIC_ARRANGER_API: process.env.NEXT_PUBLIC_ARRANGER_API_URL,
NEXT_PUBLIC_ARRANGER_DOCUMENT_TYPE: process.env.NEXT_PUBLIC_ARRANGER_DOCUMENT_TYPE,
NEXT_PUBLIC_ARRANGER_INDEX: process.env.NEXT_PUBLIC_ARRANGER_INDEX,
NEXT_PUBLIC_ARRANGER_MANIFEST_COLUMNS: process.env.NEXT_PUBLIC_ARRANGER_MANIFEST_COLUMNS,
// using ASSET_PREFIX for the public runtime BASE_PATH because basePath in the top level config was not working
// with the dms reverse proxy setup
NEXT_PUBLIC_BASE_PATH: process.env.ASSET_PREFIX,
NEXT_PUBLIC_ADMIN_EMAIL: process.env.NEXT_PUBLIC_ADMIN_EMAIL,
NEXT_PUBLIC_LAB_NAME: process.env.NEXT_PUBLIC_LAB_NAME,
NEXT_PUBLIC_LOGO_FILENAME: process.env.NEXT_PUBLIC_LOGO_FILENAME,
NEXT_PUBLIC_SSO_PROVIDERS: process.env.NEXT_PUBLIC_SSO_PROVIDERS,
// Optional features/functionalities
NEXT_PUBLIC_DEBUG: process.env.NEXT_PUBLIC_DEBUG,
// Keycloak auth
NEXT_PUBLIC_KEYCLOAK_HOST: process.env.NEXT_PUBLIC_KEYCLOAK_HOST,
NEXT_PUBLIC_KEYCLOAK_REALM: process.env.NEXT_PUBLIC_KEYCLOAK_REALM,
NEXT_PUBLIC_KEYCLOAK_CLIENT_ID: process.env.NEXT_PUBLIC_KEYCLOAK_CLIENT_ID,
NEXT_PUBLIC_KEYCLOAK_PERMISSION_AUDIENCE: process.env.NEXT_PUBLIC_KEYCLOAK_PERMISSION_AUDIENCE,
NEXT_PUBLIC_AUTH_PROVIDER: process.env.NEXT_PUBLIC_AUTH_PROVIDER,
},
assetPrefix: process.env.ASSET_PREFIX || '',
optimizeFonts: false,
experimental: {
esmExternals: 'loose',
},
});