Skip to content

fix(page-agent): add separate UMD library entry without auto-init#339

Open
joaquinescalante23 wants to merge 1 commit intoalibaba:mainfrom
joaquinescalante23:fix/umd-library-entry
Open

fix(page-agent): add separate UMD library entry without auto-init#339
joaquinescalante23 wants to merge 1 commit intoalibaba:mainfrom
joaquinescalante23:fix/umd-library-entry

Conversation

@joaquinescalante23
Copy link
Copy Markdown

@joaquinescalante23 joaquinescalante23 commented Mar 23, 2026

What

Fix #337 - loading the CDN bundle was auto-running the demo instead of exporting a usable library.

The issue: dist/umd/page-agent.js was built from demo.ts, which immediately initializes with hardcoded demo credentials (qwen3.5-plus). Users expect to load it and use it programmatically.

Type

  • Bug fix
  • Feature / Improvement
  • Refactor
  • Documentation
  • Website
  • Demo / Testing
  • Breaking change

Changes

  • src/page-agent.ts: new entry point that just exports PageAgent without demo auto-init
  • vite.umd.config.js: builds to dist/umd/page-agent.js
  • package.json: adds build:umd script

Testing

  • dist/umd/page-agent.js contains no qwen3.5-plus
  • dist/iife/page-agent.demo.js still works with demo

Add dedicated entry point for programmatic library usage separate from
demo auto-initialization.

- src/page-agent.ts: Library entry exporting PageAgent class without
  auto-init. Includes JSDoc documenting usage pattern and rationale
  for window side-effect (standard practice for IIFE/UMD libraries).

- vite.umd.config.js: Vite config for building library bundle to
  dist/umd/page-agent.js. Documents EVAL suppression rationale and
  clarifies "UMD" vs IIFE naming.

- package.json: Add build:umd script, update build to generate both
  library (dist/umd/) and demo (dist/iife/) bundles.

Fixes alibaba#337
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.

Non-demo CDN

1 participant