-
Notifications
You must be signed in to change notification settings - Fork 419
Feat: Babel plugin for Vite define replacements in Playwright #6904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Implements a solution to handle Vite define replacements during Playwright's Babel compilation for i18n collection tests. This resolves ReferenceErrors caused by unprocessed compile-time constants like __DISTRIBUTION__. Changes: - Add babel-plugin-vite-define.cjs to replace Vite define constants - Add babel-plugin-inject-globals.cjs to inject browser globals setup - Add setup-i18n-globals.mjs for JSDOM-based browser environment - Update playwright.i18n.config.ts with Babel plugin configuration - Install babel-plugin-module-resolver for @ alias support The implementation follows the approach from PR #5515 but is adapted for the current codebase structure. The Babel plugins run during Playwright's test compilation to ensure all Vite define constants are replaced with their actual values before execution. Fixes #10981 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
🎭 Playwright Test Results⏰ Completed at: 11/25/2025, 05:35:54 AM UTC 📈 Summary
📊 Test Reports by Browser
🎉 Click on the links above to view detailed test results for each browser configuration. |
🎨 Storybook Build Status✅ Build completed successfully! ⏰ Completed at: 11/25/2025, 05:23:31 AM UTC 🔗 Links🎉 Your Storybook is ready for review! |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Bundle Size ReportSummary
Category Glance Per-category breakdownApp Entry Points — 3.18 MB (baseline 3.18 MB) • ⚪ 0 BMain entry bundles and manifests
Graph Workspace — 940 kB (baseline 940 kB) • ⚪ 0 BGraph editor runtime, canvas, workflow orchestration
Views & Navigation — 6.54 kB (baseline 6.54 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces
Panels & Settings — 297 kB (baseline 297 kB) • ⚪ 0 BConfiguration panels, inspectors, and settings screens
UI Components — 139 kB (baseline 139 kB) • ⚪ 0 BReusable component library chunks
Data & Services — 12.5 kB (baseline 12.5 kB) • ⚪ 0 BStores, services, APIs, and repositories
Utilities & Hooks — 2.94 kB (baseline 2.94 kB) • ⚪ 0 BHelpers, composables, and utility bundles
Vendor & Third-Party — 8.56 MB (baseline 8.56 MB) • ⚪ 0 BExternal libraries and shared vendor chunks
Other — 3.84 MB (baseline 3.84 MB) • ⚪ 0 BBundles that do not match a named category
|
Summary
Implements Babel plugins to handle Vite define replacements during Playwright's compilation for i18n collection tests. This resolves ReferenceErrors caused by unprocessed compile-time constants like
__DISTRIBUTION__.Related to Notion task: https://www.notion.so/comfy-org/Implement-Babel-plugin-for-Vite-define-replacements-in-Playwright-2b56d73d365081d5bb63e02712912b17
Problem
Playwright's Babel compilation does not run Vite's
definereplacements, causing reference errors during i18n collection. The__DISTRIBUTION__reference fromcoreMenuCommands.ts(viasrc/platform/distribution/types.ts) remains raw and causes failures.See failing CI: https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/19624786760/job/56191480523
Solution
Following the approach from PR #5515, this PR adds:
1. babel-plugin-vite-define.cjs
__DISTRIBUTION__,__COMFYUI_FRONTEND_VERSION__, etc.) during Babel transformation2. babel-plugin-inject-globals.cjs
collect-i18n-3. setup-i18n-globals.mjs
window,document,navigator, and other browser globals4. Updated playwright.i18n.config.ts
@alias supportChanges
babel-plugin-vite-define.cjsto replace Vite define constantsbabel-plugin-inject-globals.cjsto inject browser globals setupsetup-i18n-globals.mjsfor JSDOM-based browser environmentplaywright.i18n.config.tswith Babel plugin configurationknip.config.tsto ignore babel-plugin-module-resolverbabel-plugin-module-resolverfor @ alias supportTest Plan
__DISTRIBUTION__and other defines are properly replacedNotes
__DISTRIBUTION__ = "localhost")🤖 Generated with Claude Code
Fixes #10981
┆Issue is synchronized with this Notion page by Unito