Skip to content

Reload global.vars browser defines in watch mode and warn on esbuild.settings changes - #378

Merged
bcomnes merged 1 commit into
masterfrom
feat/watch-warn-stale-esbuild-config
Dec 4, 2026
Merged

bcomnes merged 1 commit into
masterfrom
feat/watch-warn-stale-esbuild-config

Conversation

@bcomnes

@bcomnes bcomnes commented Dec 4, 2026 •

Copy link
Copy Markdown
Owner

Closes #363

Replaces the earlier cross-cutting warning plumbing with a cleaner split:

  • global.vars.* browser export (lib/build-esbuild/browser-vars-worker.js, lib/build-esbuild/index.js): In watch mode (modeOpts.watch === true), createBrowserBuildOpts() resolves global.vars.*'s browser export in a short-lived worker thread and serializes each entry with JSON.stringify inside the worker. Edits, additions, and removals of export const browser (and its imports) now reload live during watch rebuilds without polluting the main-thread ESM cache. Single builds remain unchanged with zero worker overhead.
  • esbuild.settings.* (lib/watch/index.js): Logs a clear warning in DomStackWatcher.#handleWatchBatch() when esbuild.settings.* changes, instructing the user to restart watch for esbuild config changes to take effect (with no changes to WatchEsbuildManager, WatchDependencyIndex, or WatchSnapshot).
  • Tests (lib/watch/lifecycle-tests/stale-config-warning.test.js): Verifies live reload of global.vars.js browser defines into global.client.js and the esbuild.settings.js restart warning.

@bcomnes
bcomnes force-pushed the feat/watch-warn-stale-esbuild-config branch from aa00b59 to 5031c94 Compare December 4, 2026 05:09
@bcomnes
bcomnes marked this pull request as ready for review December 4, 2026 05:10
@bcomnes

bcomnes commented Dec 4, 2026

Copy link
Copy Markdown
Owner Author

This one smells.

@bcomnes
bcomnes force-pushed the feat/watch-warn-stale-esbuild-config branch 2 times, most recently from ec7ef4d to c65e793 Compare December 4, 2026 17:56
@coveralls

coveralls commented Dec 4, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 47413834099

Coverage at 96.197% (no base build to compare)

Details

  • Coverage remained the same as the base build.
  • Patch coverage: 7 uncovered changes across 1 file (84 of 91 lines covered, 92.31%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
lib/build-esbuild/index.js 57 50 87.72%
Total (3 files) 91 84 92.31%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 14487
Covered Lines: 14140
Line Coverage: 97.6%
Relevant Branches: 5075
Covered Branches: 4678
Branch Coverage: 92.18%
Branches in Coverage %: Yes
Coverage Strength: 1037.54 hits per line

💛 - Coveralls

@bcomnes
bcomnes force-pushed the feat/watch-warn-stale-esbuild-config branch from c65e793 to 167bb2b Compare December 4, 2026 19:58
@bcomnes bcomnes changed the title Warn in watch mode when esbuild.settings or global.vars browser export changes Reload global.vars browser defines in watch mode and warn on esbuild.settings changes Dec 4, 2026
@bcomnes
bcomnes added this pull request to stack #380 December 4, 2026 20:17
@bcomnes
bcomnes merged commit bfbcef8 into master Dec 4, 2026
8 checks passed
@bcomnes
bcomnes deleted the feat/watch-warn-stale-esbuild-config branch December 4, 2026 20:31
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.

Warn (or restart) in watch mode when esbuild.settings or global.vars browser export changes

2 participants