## Summary
Adds a compile-time `__IS_NIGHTLY__` constant that detects whether the
build is from the main branch (nightly) or a core/* branch (RC/stable).
The detection logic in vite.config.mts auto-detects based on
`GITHUB_REF_NAME === 'main'` in CI, with explicit override support via
`IS_NIGHTLY` environment variable. Exports `isNightly` from
`src/platform/distribution/types.ts` for use throughout the codebase.
Includes unit tests for the detection logic.
┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-8149-feat-add-isNightly-build-flag-for-nightly-only-features-2ec6d73d365081c09930edec1c6644f5)
by [Unito](https://www.unito.io)
## Summary
Fixes the `ReferenceError: __DISTRIBUTION__ is not defined` error when
running i18n collection tests.
## Problem
PR #6879 added conditional menu commands based on distribution (hiding
memory unload commands in cloud). This introduced a dependency on
`isCloud` which uses the `__DISTRIBUTION__` Vite define variable in
`coreMenuCommands.ts`.
When Playwright's test runner imports this file during i18n collection,
it fails because Vite define variables are only replaced during Vite's
build/dev process, not during Playwright's TypeScript compilation.
## Solution
Created a simple shim (`scripts/vite-define-shim.ts`) that:
1. Defines all Vite define variables as global constants with default
values
2. Provides a minimal `window` shim for Node environment
3. Is imported at the top of `collect-i18n-general.ts` before any code
that uses these variables
This approach is simpler than:
- Creating a custom Babel plugin (attempted in this PR, see commit
history)
- Using `ctViteConfig` (only works for component testing, not regular
Playwright tests)
- Post-build regex replacement (fragile and error-prone)
## Test Plan
Run `pnpm collect-i18n` and verify:
- ✅ No more `ReferenceError: __DISTRIBUTION__ is not defined`
- ✅ No more `ReferenceError: window is not defined`
- ⏱️ Tests may timeout if dev server is not running on port 5173, but
that's a separate issue
## Related
- Fixes issue introduced by PR #6879
- Related to Notion task:
https://www.notion.so/comfy-org/Implement-Babel-plugin-for-Vite-define-replacements-in-Playwright-2b56d73d365081d5bb63e02712912b17🤖 Generated with [Claude Code](https://claude.com/claude-code)
┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-6906-bugfix-Add-vite-define-shim-for-Playwright-i18n-collection-2b66d73d36508182b4d6d69b88ae2771)
by [Unito](https://www.unito.io)
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Alexander Brown <drjkl@comfy.org>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>