diff --git a/environment.mjs b/environment.mjs new file mode 100644 index 0000000..00b9456 --- /dev/null +++ b/environment.mjs @@ -0,0 +1,3 @@ +const isProd = process.env.NODE_ENV === 'production'; +const basePath = isProd ? '/klimadashboard-ka' : ''; +export default basePath \ No newline at end of file diff --git a/next.config.js b/next.config.mjs similarity index 55% rename from next.config.js rename to next.config.mjs index 7121412..c187ca3 100644 --- a/next.config.js +++ b/next.config.mjs @@ -1,11 +1,9 @@ /** @type {import('next').NextConfig} */ - -const isProd = process.env.NODE_ENV === 'production'; -export const basePath = isProd ? '/klimadashboard-ka' : ''; +import basePath from "./environment.mjs" const nextConfig = { output: 'export', - basePath, + basePath: basePath, images: { unoptimized: true diff --git a/package.json b/package.json index 4e8a755..497225e 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,6 @@ "name": "klimadashboard-ka", "version": "0.1.0", "private": true, - "type": "module", "scripts": { "dev": "next dev", "build": "cross-env NODE_ENV=production next build", diff --git a/src/app/data.ts b/src/app/data.ts index 495ed69..3d7f050 100644 --- a/src/app/data.ts +++ b/src/app/data.ts @@ -2,7 +2,7 @@ import useSWR from "swr"; import {FeinstaubDataEntry, GreenHouseGasEntry, SensorDataEntryJSON} from "@/app/api/models"; -import {basePath} from "../../next.config"; +import basePath from "../../environment.mjs"; const fetcher = (input: URL | RequestInfo, init?: RequestInit | undefined) => fetch(input, init).then((res) => res.json());