ES module imports fail via file:// or raw Forge URLs. Port 3000 (avoids conflict with L402 on :8080, see #1415). Three options: ./preview.sh, docker, GitHub Pages. Triage findings filed as new issues: #1413 #1414 #1415 Fixes #1339
28 lines
902 B
Bash
Executable File
28 lines
902 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
PORT="${1:-3000}"
|
|
if [ "$PORT" = "docker" ]; then
|
|
docker compose up -d nexus-preview
|
|
echo "==> http://localhost:3000"
|
|
exit 0
|
|
fi
|
|
if ! command -v python3 &> /dev/null; then
|
|
echo "Error: python3 not found. Use './preview.sh docker'"
|
|
exit 1
|
|
fi
|
|
echo "==> http://localhost:$PORT"
|
|
python3 -c "
|
|
import http.server,socketserver
|
|
class H(http.server.SimpleHTTPRequestHandler):
|
|
def end_headers(self):
|
|
self.send_header('Access-Control-Allow-Origin','*')
|
|
super().end_headers()
|
|
def guess_type(self,p):
|
|
if p.endswith(('.js','.mjs')): return 'application/javascript'
|
|
if p.endswith('.css'): return 'text/css'
|
|
if p.endswith('.json'): return 'application/json'
|
|
return super().guess_type(p)
|
|
with socketserver.TCPServer(('', $PORT), H) as s:
|
|
print(f'Serving http://localhost:{$PORT}'); s.serve_forever()
|
|
"
|