Add proxy target configuration and new start script for seedheads dev mode
This commit is contained in:
13
README.md
Normal file
13
README.md
Normal 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
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "webpack serve --progress --mode development --no-open",
|
"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",
|
"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:client": "cross-env NODE_ENV=production webpack --progress --mode production && shx cp dist/index.html dist/index_template.html",
|
||||||
"build": "npm run build:client",
|
"build": "npm run build:client",
|
||||||
|
|||||||
@@ -373,6 +373,7 @@ const Home = () => {
|
|||||||
}, 3000);
|
}, 3000);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container maxWidth="lg" sx={{ pt: 4, pb: 2, maxWidth: '1200px !important' }}>
|
<Container maxWidth="lg" sx={{ pt: 4, pb: 2, maxWidth: '1200px !important' }}>
|
||||||
{/* Inject the animated border and carousel styles */}
|
{/* Inject the animated border and carousel styles */}
|
||||||
|
|||||||
41
start-dev-seedheads.bat
Normal file
41
start-dev-seedheads.bat
Normal 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
|
||||||
@@ -91,6 +91,7 @@ const __filename = fileURLToPath(import.meta.url);
|
|||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename);
|
||||||
const isDevelopment = process.env.NODE_ENV !== 'production';
|
const isDevelopment = process.env.NODE_ENV !== 'production';
|
||||||
const isAnalyze = process.env.ANALYZE === 'true';
|
const isAnalyze = process.env.ANALYZE === 'true';
|
||||||
|
const proxyTarget = process.env.PROXY_TARGET || 'http://localhost:9303';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mode: isDevelopment ? 'development' : 'production',
|
mode: isDevelopment ? 'development' : 'production',
|
||||||
@@ -267,16 +268,18 @@ export default {
|
|||||||
proxy: [
|
proxy: [
|
||||||
{
|
{
|
||||||
context: ['/socket.io'],
|
context: ['/socket.io'],
|
||||||
target: 'http://localhost:9303',
|
target: proxyTarget,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
ws: true,
|
ws: true,
|
||||||
logLevel: 'debug'
|
logLevel: 'debug',
|
||||||
|
secure: proxyTarget.startsWith('https')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
context: ['/api'],
|
context: ['/api'],
|
||||||
target: 'http://localhost:9303',
|
target: proxyTarget,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
logLevel: 'debug'
|
logLevel: 'debug',
|
||||||
|
secure: proxyTarget.startsWith('https')
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
setupMiddlewares: (middlewares, devServer) => {
|
setupMiddlewares: (middlewares, devServer) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user