Skip to content

Conversation

@kazupon
Copy link
Member

@kazupon kazupon commented Dec 14, 2025

fix #2322 #2334

@coderabbitai
Copy link

coderabbitai bot commented Dec 14, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/bundler-warning

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kazupon kazupon added the Type: Improvement Includes backwards-compatible fixes label Dec 14, 2025
@kazupon kazupon changed the title fix: avoid bundler warning for getCurrentInstance compatibility fix: avoid bundler warning for getCurrentInstance compatibility Dec 14, 2025
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 14, 2025

Deploying vue-i18n-next with  Cloudflare Pages  Cloudflare Pages

Latest commit: d0b883b
Status: ✅  Deploy successful!
Preview URL: https://236cf01d.vue-i18n-next.pages.dev
Branch Preview URL: https://fix-bundler-warning.vue-i18n-next.pages.dev

View logs

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 14, 2025

Open in StackBlitz

@intlify/core

npm i https://pkg.pr.new/@intlify/core@2337

@intlify/core-base

npm i https://pkg.pr.new/@intlify/core-base@2337

@intlify/devtools-types

npm i https://pkg.pr.new/@intlify/devtools-types@2337

@intlify/message-compiler

npm i https://pkg.pr.new/@intlify/message-compiler@2337

petite-vue-i18n

npm i https://pkg.pr.new/petite-vue-i18n@2337

@intlify/shared

npm i https://pkg.pr.new/@intlify/shared@2337

vue-i18n

npm i https://pkg.pr.new/vue-i18n@2337

@intlify/vue-i18n-core

npm i https://pkg.pr.new/@intlify/vue-i18n-core@2337

commit: d0b883b

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR attempts to fix bundler warnings related to getCurrentInstance compatibility by modifying the approach used to access the currentInstance property from the Vue namespace. The change replaces string concatenation ('current' + 'Instance') with a constant variable (const key = 'currentInstance') to avoid bundler static analysis.

Key Changes:

  • Replaced string concatenation trick with a constant variable assignment for accessing currentInstance
  • Removed the inline comment explaining the bundler avoidance technique

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// NOTE(kazupon): avoid bundler static analysis
const name = 'current' + 'Instance'
return (Vue as any)[name] as GenericComponentInstance | null
const key = 'currentInstance'
Copy link

Copilot AI Dec 14, 2025

Choose a reason for hiding this comment

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

The new approach using const key = 'currentInstance' may not effectively avoid bundler static analysis warnings. Modern bundlers perform constant folding and can still detect this pattern. The previous string concatenation approach ('current' + 'Instance') was more effective at preventing static analysis because bundlers typically don't evaluate runtime string operations. Consider using a more robust approach such as computed property access or keeping the string concatenation method if the goal is to prevent bundler warnings.

Suggested change
const key = 'currentInstance'
const key = 'current' + 'Instance'

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Improvement Includes backwards-compatible fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant