Skip to content

Commit

Permalink
chore: move basePath to environment.mjs, revert using es modules
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderMelde committed Mar 3, 2024
1 parent efe51bc commit 26e53b7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
3 changes: 3 additions & 0 deletions environment.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const isProd = process.env.NODE_ENV === 'production';
const basePath = isProd ? '/klimadashboard-ka' : '';
export default basePath
6 changes: 2 additions & 4 deletions next.config.js → next.config.mjs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/app/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down

0 comments on commit 26e53b7

Please sign in to comment.