Skip to content

Conversation

snomiao
Copy link
Member

@snomiao snomiao commented Sep 25, 2025

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:

  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

// 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'
)

Copy link

github-actions bot commented Sep 25, 2025

🎭 Playwright Test Results

Some tests failed

⏰ Completed at: 09/26/2025, 05:00:51 AM UTC

📈 Summary

  • Total Tests: 461
  • Passed: 429 ✅
  • Failed: 1 ❌
  • Flaky: 2 ⚠️
  • Skipped: 29 ⏭️

📊 Test Reports by Browser

  • chromium: View Report • ✅ 422 / ❌ 1 / ⚠️ 2 / ⏭️ 29
  • chromium-2x: View Report • ✅ 2 / ❌ 0 / ⚠️ 0 / ⏭️ 0
  • chromium-0.5x: View Report • ✅ 1 / ❌ 0 / ⚠️ 0 / ⏭️ 0
  • mobile-chrome: View Report • ✅ 4 / ❌ 0 / ⚠️ 0 / ⏭️ 0

🎉 Click on the links above to view detailed test results for each browser configuration.

@snomiao snomiao force-pushed the sno-fix-locale branch 4 times, most recently from 20c099f to 3016005 Compare September 26, 2025 00:14
@snomiao snomiao marked this pull request as ready for review September 26, 2025 00:34
@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Sep 26, 2025
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Sep 26, 2025
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Sep 26, 2025
Copy link
Collaborator

@Myestery Myestery left a 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

Myestery
Myestery previously approved these changes Sep 26, 2025
@christian-byrne christian-byrne added the area:i18n Anything related to translation label Sep 26, 2025
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Sep 26, 2025
@snomiao snomiao enabled auto-merge (squash) September 26, 2025 05:04
Copy link
Contributor

@christian-byrne christian-byrne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@christian-byrne christian-byrne merged commit 3a9365a into main Sep 26, 2025
3 checks passed
@christian-byrne christian-byrne deleted the sno-fix-locale branch September 26, 2025 05:56
@christian-byrne christian-byrne added needs-backport Fix/change that needs to be cherry-picked to the current feature freeze branch 1.27 labels Sep 26, 2025
Copy link

@snomiao Backport to core/1.27 failed: Merge conflicts detected.

Please manually cherry-pick commit 3a9365af13cfd7956bb3a69b4ebd5934e39a64be to the core/1.27 branch.

Conflicting files
  • scripts/collect-i18n-node-defs.ts

1 similar comment
Copy link

@snomiao Backport to core/1.27 failed: Merge conflicts detected.

Please manually cherry-pick commit 3a9365af13cfd7956bb3a69b4ebd5934e39a64be to the core/1.27 branch.

Conflicting files
  • scripts/collect-i18n-node-defs.ts

@christian-byrne
Copy link
Contributor

I will cherry pick

christian-byrne added a commit that referenced this pull request Sep 26, 2025
… 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]>
AustinMroz pushed a commit that referenced this pull request Sep 26, 2025
…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]>
christian-byrne pushed a commit that referenced this pull request Sep 27, 2025
… 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.27 area:i18n Anything related to translation area:testing needs-backport Fix/change that needs to be cherry-picked to the current feature freeze branch size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants