fix(page-agent): add separate UMD library entry without auto-init#339
Open
joaquinescalante23 wants to merge 1 commit intoalibaba:mainfrom
Open
fix(page-agent): add separate UMD library entry without auto-init#339joaquinescalante23 wants to merge 1 commit intoalibaba:mainfrom
joaquinescalante23 wants to merge 1 commit intoalibaba:mainfrom
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Fix #337 - loading the CDN bundle was auto-running the demo instead of exporting a usable library.
The issue:
dist/umd/page-agent.jswas built fromdemo.ts, which immediately initializes with hardcoded demo credentials (qwen3.5-plus). Users expect to load it and use it programmatically.Type
Changes
src/page-agent.ts: new entry point that just exportsPageAgentwithout demo auto-initvite.umd.config.js: builds todist/umd/page-agent.jspackage.json: addsbuild:umdscriptTesting
dist/umd/page-agent.jscontains noqwen3.5-plusdist/iife/page-agent.demo.jsstill works with demo