Skip to content

fix: exclude optional vite/eslint peer deps from esbuild bundle in adk web#319

Open
sukhmanghotraa wants to merge 2 commits into
google:mainfrom
sukhmanghotraa:fix/external-optional-deps-adk-web
Open

fix: exclude optional vite/eslint peer deps from esbuild bundle in adk web#319
sukhmanghotraa wants to merge 2 commits into
google:mainfrom
sukhmanghotraa:fix/external-optional-deps-adk-web

Conversation

@sukhmanghotraa
Copy link
Copy Markdown
Contributor

Please ensure you have read the contribution guide before creating a pull request.

Link to Issue or Description of Change

1. Link to an existing issue (if applicable):

  • Closes: N/A (runtime error when running adk web)

Problem:
Running npx adk web fails immediately when listing agents with:

Could not resolve "lightningcss"
Could not resolve "jiti"
Could not resolve "jiti/package.json"

When adk web loads agent files, AgentFile.load() in agent_loader.ts uses esbuild with packages: 'bundle' to compile the agent. This pulls in all transitive dependencies including vite and eslint, which contain optional dynamic imports for lightningcss and jiti. Since those optional peer dependencies are not installed, esbuild fails at bundle time.

Solution:
Add lightningcss, jiti, and jiti/package.json to the external list in the esbuild call inside AgentFile.load(). This is consistent with how other optional/native dependencies like sqlite3, onnxruntime-node, etc. are already handled in the same list.

Testing Plan

Unit Tests:

  • No unit tests added — the fix is an esbuild external config change. the behavior is verified by adk web successfully serving /list-apps after the change.
  • All unit tests pass locally.
 Test Files  138 passed | 11 skipped (149)
      Tests  1350 passed | 23 skipped (1373)

Manual End-to-End (E2E) Tests:

  • Verified npx adk web starts successfully and /list-apps responds without errors after the fix.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works. (n/a - esbuild config fix)
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

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.

2 participants