-
Notifications
You must be signed in to change notification settings - Fork 374
fix(collect-i18n-node-defs): refactor to run ComfyNodeDefImpl only in browser context #5775
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
Conversation
🎭 Playwright Test Results❌ Some tests failed ⏰ Completed at: 09/26/2025, 05:00:51 AM UTC 📈 Summary
📊 Test Reports by Browser
🎉 Click on the links above to view detailed test results for each browser configuration. |
20c099f
to
3016005
Compare
c566517
to
3d88e80
Compare
a237b8e
to
3d88e80
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot. I've anticipated this fix for some time now
…anch detection" This reverts commit c733a27.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@snomiao Backport to Please manually cherry-pick commit Conflicting files
|
1 similar comment
@snomiao Backport to Please manually cherry-pick commit Conflicting files
|
I will cherry pick |
… browser context (#5775) The `collect-i18n-node-defs.ts` script started failing ~3 weeks ago when Vue nodes were introduced ([commit 006e6bd](006e6bd57), [PR #4263](#4263)). The issue stems from: 1. **Import chain bringing Vue components into Node.js context:** ``` collect-i18n-node-defs.ts ↓ imports ComfyNodeDefImpl (from nodeDefStore.ts) ↓ imports useSubgraphStore (from subgraphStore.ts) ↓ transitively imports executionStore.ts ↓ imports ChatHistoryWidget.vue (Vue component!) ``` 2. **TypeScript `declare` fields causing Babel errors:** ``` TypeScript 'declare' fields must first be transformed by @babel/plugin-transform-typescript ``` - Adds custom Babel plugins and configurations - Implements automatic browser globals injection - Requires **47,517 additions, 9,469 deletions** - Modifies the entire Playwright babel transformation pipeline - Uses dynamic imports to defer module loading until runtime - Avoids Babel compilation of problematic TypeScript/Vue files - **Only 40 lines changed** in a single file - No configuration changes needed ```typescript // Instead of static import that Babel tries to compile: // import { ComfyNodeDefImpl } from '../src/stores/nodeDefStore' // We use: // 1. Type-only import (erased at runtime) import type { ComfyNodeDefImpl } from '../src/stores/nodeDefStore' // 2. Dynamic import at runtime (bypasses Babel) const { ComfyNodeDefImpl: ComfyNodeDefImplClass } = await import( '../src/stores/nodeDefStore' ) ``` --------- Co-authored-by: github-actions <[email protected]>
…t fix to core/1.27 (#5796) ## Summary Backports the ComfyNodeDefImpl browser context fix from #5775 to the core/1.27 branch. ## Changes - Move ComfyNodeDefImpl instantiation to browser context to avoid Node.js compatibility issues - Add workers: 1 to playwright i18n config for consistent execution - Fix floating promise by awaiting page.route() call - Add allowDefaultProject config for playwright and script files to resolve ESLint parsing ## Original Issue The `collect-i18n-node-defs.ts` script was failing due to Vue components being imported into Node.js context, causing Babel compilation errors with TypeScript 'declare' fields. ## Solution Uses dynamic imports to defer module loading until runtime in the browser context, avoiding Babel compilation of problematic TypeScript/Vue files. Cherry-picked from 3a9365a ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5796-fix-collect-i18n-node-defs-backport-ComfyNodeDefImpl-browser-context-fix-to-core-1-27-27a6d73d365081639625f25ecf9553fd) by [Unito](https://www.unito.io) Co-authored-by: github-actions <[email protected]>
… browser context (#5775) ## The Problem The `collect-i18n-node-defs.ts` script started failing ~3 weeks ago when Vue nodes were introduced ([commit 006e6bd](006e6bd57), [PR #4263](#4263)). The issue stems from: 1. **Import chain bringing Vue components into Node.js context:** ``` collect-i18n-node-defs.ts ↓ imports ComfyNodeDefImpl (from nodeDefStore.ts) ↓ imports useSubgraphStore (from subgraphStore.ts) ↓ transitively imports executionStore.ts ↓ imports ChatHistoryWidget.vue (Vue component!) ``` 2. **TypeScript `declare` fields causing Babel errors:** ``` TypeScript 'declare' fields must first be transformed by @babel/plugin-transform-typescript ``` ## This Solution vs PR #5515 ### PR #5515 Approach (Complex) - Adds custom Babel plugins and configurations - Implements automatic browser globals injection - Requires **47,517 additions, 9,469 deletions** - Modifies the entire Playwright babel transformation pipeline ### This PR's Approach (Simple) - Uses dynamic imports to defer module loading until runtime - Avoids Babel compilation of problematic TypeScript/Vue files - **Only 40 lines changed** in a single file - No configuration changes needed ## How This Fix Works ```typescript // Instead of static import that Babel tries to compile: // import { ComfyNodeDefImpl } from '../src/stores/nodeDefStore' // We use: // 1. Type-only import (erased at runtime) import type { ComfyNodeDefImpl } from '../src/stores/nodeDefStore' // 2. Dynamic import at runtime (bypasses Babel) const { ComfyNodeDefImpl: ComfyNodeDefImplClass } = await import( '../src/stores/nodeDefStore' ) ``` --------- Co-authored-by: github-actions <[email protected]>
The Problem
The
collect-i18n-node-defs.ts
script started failing ~3 weeks ago when Vue nodes were introduced (commit 006e6bd57, PR #4263). The issue stems from:Import chain bringing Vue components into Node.js context:
TypeScript
declare
fields causing Babel errors:This Solution vs PR #5515
PR #5515 Approach (Complex)
This PR's Approach (Simple)
How This Fix Works