-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.ts
More file actions
49 lines (42 loc) · 1.71 KB
/
next.config.ts
File metadata and controls
49 lines (42 loc) · 1.71 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
import type { NextConfig } from "next";
import packageJson from './package.json';
process.env.BROWSERSLIST_IGNORE_OLD_DATA ??= 'true';
process.env.BASELINE_BROWSER_MAPPING_IGNORE_OLD_DATA ??= 'true';
const isProd = process.env.NODE_ENV === "production";
const internalHost = process.env.TAURI_DEV_HOST || "localhost";
const devPort = process.env.PORT || "1420";
// Enable static export for Tauri production builds.
// This makes `pnpm build` generate the `out/` directory that Tauri loads from `src-tauri/tauri.conf.json` (frontendDist: "../out").
const nextConfig: NextConfig = {
output: isProd ? "export" : undefined,
env: {
NEXT_PUBLIC_APP_VERSION: packageJson.version,
NEXT_PUBLIC_BUILD_DATE: new Date().toISOString().split('T')[0],
},
// Note: This feature is required to use the Next.js Image component in SSG mode.
// See https://nextjs.org/docs/messages/export-image-api for different workarounds.
images: {
unoptimized: true,
},
// Configure assetPrefix or else the server won't properly resolve your assets.
assetPrefix: isProd ? undefined : `http://${internalHost}:${devPort}`,
// Empty turbopack config to silence webpack warning (Next.js 16 uses Turbopack by default)
turbopack: {},
// Rewrites for development - proxy Stellarium data requests to bypass CORS
// Note: These only work in dev mode, not with static export
...(isProd ? {} : {
async rewrites() {
return [
{
source: '/stellarium-proxy/:path*',
destination: 'https://data.stellarium-web.org/:path*',
},
{
source: '/cds-proxy/:path*',
destination: 'https://alasky.cds.unistra.fr/:path*',
},
];
},
}),
};
export default nextConfig;