-
- Notifications
You must be signed in to change notification settings - Fork 377
fix: Set default value for __FEATURE_PROD_VUE_DEVTOOLS__ flag #2256
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
fix: Set default value for __FEATURE_PROD_VUE_DEVTOOLS__ flag
WalkthroughAdds a guard in initFeatureFlags to define a global VUE_PROD_DEVTOOLS as false when the corresponding feature flag is not a boolean, mirroring existing handling for INTLIFY_PROD_DEVTOOLS. No public APIs or signatures changed. Changes
Sequence Diagram(s)sequenceDiagram participant Importer as Consumer (SSR/App) participant Module as vue-i18n-core/misc participant Global as Global Scope Importer->>Module: import/init activate Module Module->>Module: initFeatureFlags() alt __FEATURE_PROD_VUE_DEVTOOLS__ not boolean Module->>Global: set __VUE_PROD_DEVTOOLS__ = false else already boolean Module->>Global: leave as-is end Note over Module,Global: Mirrors existing __INTLIFY_PROD_DEVTOOLS__ guard deactivate Module Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Assessment against linked issues
Poem
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/vue-i18n-core/src/misc.ts (1)
32-34
: Confirm early invocation order to avoid residual ReferenceError.This guard only helps if
initFeatureFlags()
runs before any bare uses of__VUE_PROD_DEVTOOLS__
.Run to confirm it’s invoked in ESM-bundler entrypoints:
#!/bin/bash # Where is initFeatureFlags imported/called? rg -nP '\binitFeatureFlags\s*\(' -C3 --type=ts # Also check for unsafe bare reads that could execute before the guard rg -nP '(?<!typeof\s)\b__VUE_PROD_DEVTOOLS__\b' -C2 --type=ts -g '!*dist/**'If unsafe reads are found, I can propose minimal patches to wrap them with
typeof
checks or usegetGlobalThis().__VUE_PROD_DEVTOOLS__
.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/vue-i18n-core/src/misc.ts
(1 hunks)
🔇 Additional comments (2)
packages/vue-i18n-core/src/misc.ts (2)
32-34
: Good guard; mirrors existing INTLIFY flag default.Setting
__VUE_PROD_DEVTOOLS__
tofalse
when the feature macro isn’t defined should prevent the SSR ReferenceError in externalized builds. Placement aligns with the existing pattern above.
32-34
: Ensure macro typings and build defines exist.TypeScript will error if
__FEATURE_PROD_VUE_DEVTOOLS__
isn’t declared, and the build should optionally define it when enabling prod devtools.Run to verify typings and defines:
#!/bin/bash # 1) Macro typings (should exist alongside other feature-flag declarations) rg -nP '__FEATURE_PROD_VUE_DEVTOOLS__|__VUE_PROD_DEVTOOLS__' -g '*.{d.ts,ts}' # 2) Build-time defines (rollup/vite/esbuild configs or scripts) rg -nP '__FEATURE_PROD_VUE_DEVTOOLS__|__VUE_PROD_DEVTOOLS__' -g '*.{js,cjs,mjs,ts}' -S \ -C3 -g '!*node_modules/**'
@babu-ch This is not a bug, and it is already fixable.
|
@kazupon |
So that flag is set by Vue. I learned something 👍 |
fix #2253
Summary by CodeRabbit