Downgrade to Angular 17 with webpack for better restricted environment compatibility
- Downgrade from Angular 19 to Angular 17.3.0 - Switch from Vite-based build (@angular/build) to webpack (@angular-devkit/build-angular) - Eliminates Vite, esbuild, and rollup dependencies that were causing issues in restricted npm environments - Update tsconfig.json for webpack compatibility (moduleResolution: bundler) - Update angular.json to use browser builder instead of application builder - Update docker-compose.yml to use prebuilt Dockerfile for air-gapped deployment - Add build-for-airgap.sh helper script for local builds - Update DEPLOYMENT.md with Angular 17 webpack strategy notes - Bundle size: 329.73 kB raw / 86.54 kB gzipped This change improves compatibility with enterprise environments that have restricted package registry access. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -26,13 +26,15 @@ This uses `Dockerfile.frontend` which:
|
||||
|
||||
## Option 2: Pre-built Deployment (Air-Gapped/Restricted Environments)
|
||||
|
||||
Use `Dockerfile.frontend.prebuilt` for environments with restricted npm access or when esbuild platform binaries cannot be downloaded.
|
||||
Use `Dockerfile.frontend.prebuilt` for environments with restricted npm access.
|
||||
|
||||
**Requirements:**
|
||||
- Node.js 24+ installed locally
|
||||
- Node.js 18+ installed locally
|
||||
- npm installed locally
|
||||
- No internet required during Docker build
|
||||
|
||||
**Note:** This project uses Angular 17 with webpack bundler (not Vite) for better compatibility with restricted npm environments.
|
||||
|
||||
**Usage:**
|
||||
|
||||
### Step 1: Build Angular app locally
|
||||
@@ -71,26 +73,16 @@ This uses `Dockerfile.frontend.prebuilt` which:
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### esbuild Platform Binary Issues
|
||||
### Build Tool Package Issues
|
||||
|
||||
If you see errors like:
|
||||
If you see errors about missing packages like:
|
||||
```
|
||||
Could not resolve "@esbuild/darwin-arm64"
|
||||
Cannot find package "vite"
|
||||
Cannot find package "esbuild"
|
||||
Cannot find package "rollup"
|
||||
```
|
||||
|
||||
**Solution 1:** Use Option 2 (Pre-built) above
|
||||
|
||||
**Solution 2:** Add platform binaries to package.json (already included):
|
||||
```json
|
||||
"optionalDependencies": {
|
||||
"@esbuild/darwin-arm64": "^0.25.4",
|
||||
"@esbuild/darwin-x64": "^0.25.4",
|
||||
"@esbuild/linux-arm64": "^0.25.4",
|
||||
"@esbuild/linux-x64": "^0.25.4"
|
||||
}
|
||||
```
|
||||
|
||||
**Solution 3:** Use custom npm registry with cached esbuild binaries
|
||||
**Solution:** This project uses Angular 17 with webpack bundler specifically to avoid these issues. If you still encounter package access problems in your restricted environment, use Option 2 (Pre-built) deployment above, which eliminates all npm dependencies in Docker.
|
||||
|
||||
### Custom NPM Registry
|
||||
|
||||
@@ -109,5 +101,20 @@ NPM_REGISTRY=http://your-proxy ./quickstart.sh
|
||||
## Recommendation
|
||||
|
||||
- **Development/Cloud**: Use Option 1 (standard)
|
||||
- **Air-gapped/Enterprise**: Use Option 2 (pre-built)
|
||||
- **Air-gapped/Enterprise**: Use Option 2 (pre-built) ⭐ **RECOMMENDED**
|
||||
- **CI/CD**: Use Option 2 for faster, more reliable builds
|
||||
- **Restricted npm access**: Use Option 2 (pre-built) ⭐ **REQUIRED**
|
||||
|
||||
---
|
||||
|
||||
## Build Strategy for Restricted Environments
|
||||
|
||||
**This project uses Angular 17 with webpack** instead of Angular 19 with Vite specifically for better compatibility with restricted npm environments. Webpack has fewer platform-specific binary dependencies than Vite.
|
||||
|
||||
If you encounter any package access errors during builds:
|
||||
- `Cannot find package "vite"`
|
||||
- `Cannot find package "rollup"`
|
||||
- `Cannot find package "esbuild"`
|
||||
- Any platform-specific binary errors
|
||||
|
||||
**Solution:** Use Option 2 (Pre-built) deployment. This completely avoids npm installation in Docker and eliminates all build tool dependency issues.
|
||||
|
||||
Reference in New Issue
Block a user