2022-04-18 08:32:57 +03:00
|
|
|
const withLess = require('next-with-less');
|
2022-10-28 09:13:07 +03:00
|
|
|
const withBundleAnalyzer = require('@next/bundle-analyzer')({
|
|
|
|
enabled: process.env.ANALYZE === 'true',
|
|
|
|
});
|
2023-11-30 07:27:14 +03:00
|
|
|
const { PHASE_DEVELOPMENT_SERVER } = require('next/constants');
|
2023-05-20 04:52:11 +03:00
|
|
|
|
2023-05-19 23:56:45 +03:00
|
|
|
const withPWA = require('next-pwa')({
|
|
|
|
dest: 'public',
|
2024-11-10 01:08:45 +03:00
|
|
|
runtimeCaching: [],
|
2023-05-19 23:56:45 +03:00
|
|
|
register: true,
|
|
|
|
skipWaiting: true,
|
2023-06-05 21:06:10 +03:00
|
|
|
disableDevLogs: true,
|
2023-05-19 23:56:45 +03:00
|
|
|
publicExcludes: ['!img/platformlogos/**/*', '!styles/admin/**/*'],
|
|
|
|
buildExcludes: [/chunks\/pages\/admin.*/, '!**/admin/**/*'],
|
|
|
|
sourcemap: process.env.NODE_ENV === 'development',
|
2023-05-20 04:52:11 +03:00
|
|
|
disable: process.env.NODE_ENV === 'development',
|
2023-05-19 23:56:45 +03:00
|
|
|
});
|
2022-04-18 08:32:57 +03:00
|
|
|
|
2023-11-30 07:27:14 +03:00
|
|
|
async function rewrites() {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
source: '/api/:path*',
|
|
|
|
destination: 'http://localhost:8080/api/:path*', // Proxy to Backend to work around CORS.
|
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/hls/:path*',
|
|
|
|
destination: 'http://localhost:8080/hls/:path*', // Proxy to Backend to work around CORS.
|
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/img/:path*',
|
|
|
|
destination: 'http://localhost:8080/img/:path*', // Proxy to Backend to work around CORS.
|
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/logo',
|
|
|
|
destination: 'http://localhost:8080/logo', // Proxy to Backend to work around CORS.
|
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/thumbnail.jpg',
|
|
|
|
destination: 'http://localhost:8080/thumbnail.jpg', // Proxy to Backend to work around CORS.
|
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/customjavascript',
|
|
|
|
destination: 'http://localhost:8080/customjavascript', // Proxy to Backend to work around CORS.
|
|
|
|
},
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = async phase => {
|
|
|
|
/**
|
|
|
|
* @type {import('next').NextConfig}
|
|
|
|
*/
|
|
|
|
let nextConfig = withPWA(
|
|
|
|
withBundleAnalyzer(
|
|
|
|
withLess({
|
|
|
|
productionBrowserSourceMaps: process.env.SOURCE_MAPS === 'true',
|
|
|
|
trailingSlash: true,
|
|
|
|
reactStrictMode: true,
|
|
|
|
images: {
|
|
|
|
unoptimized: true,
|
|
|
|
},
|
|
|
|
swcMinify: true,
|
2024-11-10 01:08:45 +03:00
|
|
|
transpilePackages: [
|
|
|
|
'antd',
|
|
|
|
'@ant-design',
|
|
|
|
'rc-util',
|
|
|
|
'rc-pagination',
|
|
|
|
'rc-picker',
|
|
|
|
'rc-notification',
|
|
|
|
'rc-tooltip',
|
|
|
|
'rc-tree',
|
|
|
|
'rc-table',
|
|
|
|
],
|
2023-11-30 07:27:14 +03:00
|
|
|
webpack(config) {
|
|
|
|
config.module.rules.push({
|
|
|
|
test: /\.svg$/i,
|
|
|
|
issuer: /\.[jt]sx?$/,
|
|
|
|
use: ['@svgr/webpack'],
|
|
|
|
});
|
2022-05-18 07:20:27 +03:00
|
|
|
|
2023-11-30 07:27:14 +03:00
|
|
|
return config;
|
|
|
|
},
|
|
|
|
pageExtensions: ['tsx'],
|
|
|
|
}),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
|
|
|
if (phase === PHASE_DEVELOPMENT_SERVER) {
|
|
|
|
nextConfig = {
|
|
|
|
...nextConfig,
|
|
|
|
rewrites,
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
nextConfig = {
|
|
|
|
...nextConfig,
|
|
|
|
output: 'export',
|
|
|
|
};
|
|
|
|
}
|
|
|
|
return nextConfig;
|
|
|
|
};
|