Add proxy target configuration and new start script for seedheads dev mode

This commit is contained in:
seb
2025-07-02 13:21:08 +02:00
parent edbd56f6a9
commit 10b7f0ed7b
5 changed files with 63 additions and 4 deletions

13
README.md Normal file
View File

@@ -0,0 +1,13 @@
# Schnellstart
## Voraussetzungen
1. **Node.js herunterladen**: [nodejs.org](https://nodejs.org) - LTS-Version installieren
2. **VSCode herunterladen**: [code.visualstudio.com](https://code.visualstudio.com) - Stabile Version installieren
[ZIP herunterladen](https://github.com/Growheads-de/shopFrontEnd/archive/refs/heads/live.zip)
Entpacken & Doppelklick auf `start-dev-seedheads.bat` - das Skript wird:
- Abhängigkeiten automatisch installieren falls nötig
- Entwicklungsserver mit API-Proxy zu seedheads.de starten
- Browser öffnen auf http://localhost:9500

View File

@@ -5,6 +5,7 @@
"main": "index.js",
"scripts": {
"start": "webpack serve --progress --mode development --no-open",
"start:seedheads": "cross-env PROXY_TARGET=https://seedheads.de webpack serve --progress --mode development --no-open",
"prod": "webpack serve --progress --mode production --no-client-overlay --no-client --no-web-socket-server --no-open --no-live-reload --no-hot --compress --no-devtool",
"build:client": "cross-env NODE_ENV=production webpack --progress --mode production && shx cp dist/index.html dist/index_template.html",
"build": "npm run build:client",

View File

@@ -372,6 +372,7 @@ const Home = () => {
animationIdRef.current = requestAnimationFrame(animate);
}, 3000);
};
return (
<Container maxWidth="lg" sx={{ pt: 4, pb: 2, maxWidth: '1200px !important' }}>

41
start-dev-seedheads.bat Normal file
View File

@@ -0,0 +1,41 @@
@echo off
echo Starting ReactShop Development Server with Seedheads.de API Proxy...
echo.
REM Check if node_modules directory exists
if not exist "node_modules" (
echo node_modules directory not found. Installing dependencies...
echo.
npm install .
if errorlevel 1 (
echo.
echo ERROR: npm install failed!
pause
exit /b 1
)
echo.
echo Dependencies installed successfully!
echo.
) else (
echo node_modules found, skipping installation.
echo.
)
REM Start the development server
echo Starting development server with Seedheads.de proxy...
echo Server will be available at: http://localhost:9500
echo API calls will be proxied to: https://seedheads.de
echo Press Ctrl+C to stop the server
echo.
REM Wait a moment then open Chrome
timeout /t 3 /nobreak >nul
start "" "C:\Program Files\Google\Chrome\Application\chrome.exe" "http://localhost:9500"
REM Start the npm server (this will block until stopped)
npm run start:seedheads
REM This will only execute if the server is stopped
echo.
echo Development server stopped.
pause

View File

@@ -91,6 +91,7 @@ const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const isDevelopment = process.env.NODE_ENV !== 'production';
const isAnalyze = process.env.ANALYZE === 'true';
const proxyTarget = process.env.PROXY_TARGET || 'http://localhost:9303';
export default {
mode: isDevelopment ? 'development' : 'production',
@@ -267,16 +268,18 @@ export default {
proxy: [
{
context: ['/socket.io'],
target: 'http://localhost:9303',
target: proxyTarget,
changeOrigin: true,
ws: true,
logLevel: 'debug'
logLevel: 'debug',
secure: proxyTarget.startsWith('https')
},
{
context: ['/api'],
target: 'http://localhost:9303',
target: proxyTarget,
changeOrigin: true,
logLevel: 'debug'
logLevel: 'debug',
secure: proxyTarget.startsWith('https')
}
],
setupMiddlewares: (middlewares, devServer) => {