Skip to content

feat: replace webpack with esbuild (100s → 2.3s builds) - #2

Open
ChakshuGautam wants to merge 396 commits into
developfrom
feat/esbuild-migration
Open

feat: replace webpack with esbuild (100s → 2.3s builds)#2
ChakshuGautam wants to merge 396 commits into
developfrom
feat/esbuild-migration

Conversation

@ChakshuGautam

Copy link
Copy Markdown
Owner

Summary

  • Adds esbuild as the production bundler, reducing frontend build times from ~100 seconds (webpack) to ~2.3 seconds
  • build:webpack script now runs yarn build:libraries && yarn build:esbuild — the webpack config is preserved for local dev (yarn start) but production builds use esbuild
  • Adds dev-build.sh for fast local iteration: rebuild + deploy to running container in ~4 seconds

Changes

File What
esbuild.build.js Full esbuild config: CDN externals plugin (React, ReactDOM, etc. from unpkg), SVG loader, React dedup aliases, HTML injection into public/index.html, chunk splitting
dev-build.sh Shell script for local dev: runs esbuild + copies output to running digit-ui container
webpack.config.js Adds resolve.alias for local core module source + React singleton (prevents "Invalid hook call" from duplicate React instances)
package.json Adds esbuild dep, build:esbuild script, updates build:webpack to call esbuild

How it works

esbuild bundles the app into build/ with:

  • CDN externals: React, ReactDOM, react-router-dom, etc. loaded from unpkg <script> tags (same pattern as existing setup)
  • SVG plugin: Wraps SVG imports as React components
  • React dedup: Aliases React/ReactDOM/react-query to single instances from node_modules/
  • Local source override: @egovernments/digit-ui-module-core resolves to local micro-ui-internals/packages/modules/core so custom App.js/Login changes are included
  • HTML injection: Injects built JS/CSS into public/index.html template

Test plan

  • Run yarn build:webpack — should complete in ~3 seconds and produce build/ directory
  • Run Docker build — docker build -f docker/Dockerfile . should succeed
  • Verify the built app loads at /digit-ui/ with all pages functional
  • Verify yarn start (webpack dev server) still works for local development

🤖 Generated with Claude Code

salaudeenegov and others added 30 commits December 15, 2025 07:28
…rarchy, read_boundary_entities, read_boundary_relationships, read_workflow_states, read_workflow_actions methods to streamline codebase and improve maintainability.
… templates for boundary management and employee master
vinothrallapalli-eGov and others added 26 commits February 23, 2026 17:48
Batch fix for local-setup issues plus a new cross-root tenant bootstrap
feature with full CI coverage.

Fixes:
- egovernments#192: Remove Elasticsearch references from smoke-tests, Tiltfile, docs
- egovernments#193: Change localeDefault from "en_IN" to "en" (prevents en_IN_IN key)
- egovernments#214: PGR Update (Assign) sends assignees array instead of empty
- egovernments#215: Remove extra audit block from update bodies; Rate&Close uses []
- egovernments#216: File Upload uses {{authToken}} instead of hardcoded token
- egovernments#217: Citizen Auth Token uses correct defaults, fix pm.environment.set
- egovernments#220: Add opt-in telemetry via Matomo HTTP Tracking API

New feature:
- egovernments#225: Auto-bootstrap new tenant roots in create_tenant - copies all
  MDMS schemas, essential data (IdFormat, departments, designations,
  complaint types, workflow) from source root. Includes CI test that
  creates "ciboot.citya", bootstraps "ciboot" root from "pg", and runs
  the full PGR lifecycle (create → assign → resolve → rate&close).

Testing:
- Bootstrap data integrity: verifies IdFormat, departments, ServiceDefs,
  workflow states, and ID generation all work on bootstrapped root
- Postman assertions: each PGR step now validates HTTP 200, response
  shape, and expected applicationStatus transition
- 16 assertions per Newman run (up from 1), on both pg.citest and
  ciboot.citya tenants

CI improvements:
- Trigger workflow on PRs targeting develop branch
- Fix ImportError for relative imports in CI context
- Use serviceCode override in MDMSv2 PGR Search to prevent flakiness
- Capture ci-dataloader stdout on failure (set +e pattern)

Closes egovernments#192, closes egovernments#193, closes egovernments#214, closes egovernments#215, closes egovernments#216,
closes egovernments#217, closes egovernments#220, closes egovernments#225

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add telemetry sidecar (alpine:3.20) that monitors Docker socket for
  container start/stop/health events and sends them to Matomo
- Detects which docker-compose file(s) were used via container labels
- Sends setup start/stop events on compose up/down (SIGTERM handler)
- Tracks individual container lifecycle (start, die, unhealthy)
- Update Matomo site ID from 1 to 5 in telemetry.sh and telemetry.py
- Update events.csv catalog with new container-level events
- Skip digit-telemetry in CI health check loop

Opt-out: TELEMETRY=false (same env var as existing telemetry)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Send container healthy events (previously only logged, not sent)
- Fix stop event not arriving: shutdown handler now uses synchronous
  curl (foreground) instead of backgrounded curl that got killed on exit
- Remove set -e that could cause early exits in signal handlers
- Kill events monitor PID before sending stop event
- Add container healthy event to events.csv catalog

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Script tests the full boundary lifecycle as done in the DataLoader notebook:
1. Login and create test tenant (pg.bndtest)
2. Create boundary hierarchy definition (BNDTEST: State→District→Block)
3. Generate boundary template via egov-bndry-mgmnt
4. Poll for completion and download the XLSX template
5. Fill the template programmatically with 6 test boundaries
6. Upload filled template and process boundaries
7. Verify boundaries exist via boundary-service API

Handles both template formats (standard and column-per-level).
Falls back to direct API creation if template generation fails.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Bump egov-localization heap from -Xmx256m to -Xmx512m and container
  memory limit from 320M to 640M. The boundary management service
  fetches all 34K localization messages at once during template
  generation, causing OutOfMemoryError: Java heap space.
- Fix filestore download URL resolution inside Docker containers:
  map localhost:19000 (MinIO host port) to minio:9000 (container DNS)
  so Jupyter notebook can download boundary templates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds an always-run step that prints the telemetry container logs
before cleanup, so we can verify which events are being sent.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Two bugs:
1. Docker API returns `.Action` not `.status` — sidecar was reading
   the wrong JSON field so health events were silently dropped
2. Docker sends `health_status: healthy` (with space after colon)
   but case matched `health_status:healthy` (no space)

Verified by capturing raw Docker events via the unix socket API.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
On `docker compose down`, the sidecar was killing its event stream
immediately on SIGTERM, missing die events from other containers.

Now waits 3s after SIGTERM to let the event stream capture die events
from other containers being stopped, then sends the stop summary.
Bumped stop_grace_period to 10s to accommodate the delay.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Matomo filters out requests with curl's default user-agent as bot
traffic. All three telemetry senders (sidecar.sh, telemetry.py,
telemetry.sh) now send `User-Agent: DIGIT-LocalSetup/1.0`.

Also changed URL from `app://local-setup/...` to
`https://local-setup.digit.org/...` — Matomo may reject non-HTTP
URL schemes in reports.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
docs: improve local-setup README based on review feedback
This reverts commit 053706b.
Added a template for creating epics to the issue tracker, outlining key sections for problem identification, planning, and success measurement.
…-patch-epic-template

Add epic issue template for feature planning
Add esbuild as the production bundler, reducing build times from ~100s
(webpack) to ~2.3s. The build:webpack script now runs esbuild instead.

- esbuild.build.js: Full build config with CDN externals plugin, SVG
  loader, React dedup aliases, HTML injection, and chunk splitting
- dev-build.sh: Fast local rebuild + deploy to running container (~4s)
- webpack.config.js: Add resolve aliases for local core module source
  and React singleton (prevents "Invalid hook call" errors)
- package.json: Add esbuild dep, build:esbuild script

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Mar 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4be248bf-31b0-46a8-a667-23084efdd55a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/esbuild-migration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

KDwevedi added a commit that referenced this pull request May 21, 2026
Last full-path gap: fullpath7 passed EVERYTHING (converge x2, OpenBao
seal+re-unseal, Mac-nginx serving /configurator/ + /digit-ui/ at 200,
auth probe, MDMS StateInfo, INFRA VALIDATION) and failed only on the
trailing debug task 'Show MCP health status', which reads mcp_health.rc
— but mcp_health is registered only by the enable_mcp-gated wait task
(skipped on Mac), so it's undefined. Gate this status line the same
way, consistent with fix #2 and the mcp-bootstrap tasks. Linux/VPC
(enable_mcp true) unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants