Skip to content

Lazy-load UiBuild to speed up server startup#466

Open
taylortom wants to merge 1 commit into
adapt-security:masterfrom
taylortom:perf/lazy-load-build-deps
Open

Lazy-load UiBuild to speed up server startup#466
taylortom wants to merge 1 commit into
adapt-security:masterfrom
taylortom:perf/lazy-load-build-deps

Conversation

@taylortom
Copy link
Copy Markdown
Contributor

Summary

  • Convert top-level import UiBuild from './UiBuild.js' to dynamic await import('./UiBuild.js') inside build()
  • Defers loading of rollup, babel, less, terser, handlebars, etc. until the first UI build runs
  • Reduces module import time from ~2.6s to ~242ms

Closes #465

Test plan

  • Run npm start and verify server starts without errors
  • Trigger a UI build and verify it completes successfully
  • Test with --watch flag to verify file watching still works

🤖 Generated with Claude Code

UiBuild.js eagerly imports rollup, babel, less, terser, handlebars,
and other build tooling at module level. These are only needed when
actually building the UI, which happens after app.onReady().

Convert the top-level `import UiBuild from './UiBuild.js'` to a
dynamic `await import('./UiBuild.js')` inside the build() method,
deferring the heavy dependency tree until the first build runs.

Reduces this module's import time from ~2.6s to ~242ms.

Co-Authored-By: Claude Opus 4.6 (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.

Slow startup: eager build tooling import adds ~2.6s

1 participant