2024-03-12 10:40:53 +00:00
|
|
|
let baseAssetUrl = process.env.ASSET_URL ?? '/';
|
|
|
|
if (!baseAssetUrl.endsWith('/')) baseAssetUrl += '/';
|
|
|
|
|
|
|
|
let basePath = process.env.BASE_PATH ?? '';
|
|
|
|
if (basePath.endsWith('/')) basePath = basePath.slice(0, -1);
|
|
|
|
|
|
|
|
/** @type {import('next').NextConfig} */
|
|
|
|
const nextConfig = {
|
|
|
|
images: {
|
|
|
|
unoptimized: true
|
|
|
|
},
|
|
|
|
basePath,
|
|
|
|
async redirects() {
|
|
|
|
return [...(basePath ? [{
|
|
|
|
source: '/',
|
|
|
|
destination: basePath,
|
|
|
|
permanent: false,
|
|
|
|
basePath: false
|
|
|
|
}] : []), {
|
|
|
|
source: '/chuni',
|
|
|
|
destination: '/chuni/dashboard',
|
|
|
|
permanent: false
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
env: {
|
|
|
|
NEXT_PUBLIC_BASE_PATH: basePath,
|
|
|
|
NEXT_PUBLIC_ASSET_URL: baseAssetUrl
|
|
|
|
},
|
|
|
|
sassOptions: {
|
|
|
|
additionalData: `$asset-url: "${baseAssetUrl}";`
|
2024-03-24 10:04:59 +00:00
|
|
|
},
|
|
|
|
experimental: {
|
|
|
|
instrumentationHook: true
|
|
|
|
},
|
2024-03-28 00:34:41 +00:00
|
|
|
productionBrowserSourceMaps: true,
|
|
|
|
webpack: config => {
|
2024-03-30 10:29:55 +00:00
|
|
|
config.externals = [...config.externals, 'bcrypt', 'mysql2'];
|
2024-03-28 00:34:41 +00:00
|
|
|
return config;
|
|
|
|
}
|
2024-03-12 10:40:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default nextConfig;
|