automatische environment für mockData in develop ,nach "npm run build" geht autoatisch zu production
This commit is contained in:
@@ -6,7 +6,15 @@ export async function loadWindowVariables() {
|
||||
const loadScript = (src) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const script = document.createElement("script");
|
||||
script.src = `/CPL?${src}`;
|
||||
//script.src = `/CPL?${src}`;
|
||||
// Dynamischer Pfad basierend auf der Umgebung
|
||||
const environment = process.env.NEXT_PUBLIC_NODE_ENV || "production"; // Fallback auf 'production'
|
||||
|
||||
if (environment === "production") {
|
||||
script.src = `/CPL?/${src}`; // Produktions-Pfad
|
||||
} else {
|
||||
script.src = `/mockData/${src}`; // Entwicklungs-Pfad
|
||||
}
|
||||
script.async = true;
|
||||
script.onload = () => {
|
||||
resolve();
|
||||
|
||||
Reference in New Issue
Block a user