basePath wird jetzt in config.json gepflegt statt als NEXT_PUBLIC_BASE_PATH in .env.* Alle relevanten Code-Stellen lesen basePath dynamisch aus config.json Dokumentation und Beispiele in Markdown-Dateien entsprechend angepasst Erhöhte Flexibilität für Deployments ohne Rebuild
25 lines
552 B
Markdown
25 lines
552 B
Markdown
<!-- /docs/config/paths.md -->
|
|
|
|
# 📁 paths.js
|
|
|
|
Berechnet den sauberen `BASE_URL`-Pfad basierend auf `.env.production` oder
|
|
`public/config.json → basePath`.
|
|
Entfernt führende und abschließende Slashes.
|
|
|
|
## Beispiel
|
|
|
|
Wenn `basePath = "/talas5/"` in config.json gesetzt ist, wird `BASE_URL = "/talas5"` verwendet.
|
|
|
|
```js
|
|
const BASE_PATH = basePathRaw.replace(/^\/|\/$/g, "");
|
|
export const BASE_URL = BASE_PATH ? `/${BASE_PATH}` : "";
|
|
```
|
|
|
|
## Nutzung
|
|
|
|
- Für konsistente Pfadangaben im gesamten Projekt
|
|
|
|
---
|
|
|
|
[Zurück zur Übersicht](../README.md)
|