Skip to content

feat: Add firefox and chrome variable in @wxt-dev/browser #1661

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

SimYunSup
Copy link
Contributor

Overview

Add chrome and firefox variable for specific logic. I'm not sure if this implementation is correct, so I'm going to submit it as a Draft PR.

Manual Testing

Related Issue

Related #1652

Copy link

netlify bot commented May 6, 2025

Deploy Preview for creative-fairy-df92c4 failed.

Name Link
🔨 Latest commit b986555
🔍 Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/68441736e13bb60008cf3c6e

@SimYunSup SimYunSup force-pushed the feat/chrome-and-firefox branch from 3f36018 to 79bc991 Compare May 25, 2025 10:28
@SimYunSup SimYunSup marked this pull request as ready for review May 25, 2025 10:58
@SimYunSup
Copy link
Contributor Author

@aklinker1 I wanted to find type-safe import.meta.env type guard, but there wasn't.
So I added just Firefox type. Is there any that I have to implement based on issue?

@aklinker1
Copy link
Collaborator

I'm not sure if I like this change.

  • What about safari?
  • Breaking the standards - projects migrating to WXT may not know which variable to use, and projects migrating away from WXT now have more work to do.
    • Counterpoints:
      • They could just install the @wxt-dev/browser package and continue to use it
      • WXT already uses browser, which most projects don't use.
  • I would rather have a single variable include all the types, rather than exporting multiple variables each with their own types.
  • Why add a variable for chrome when the browser variable is already typed using @types/chrome?
  • What happens to this logic when Chrome releases the browser global for compatibility? if (firefox) ... else if (chrome) ... would not work anymore since it would always be firefox.

Let's continue the discussion on #1652 before doing any more work here. I'm not convinced this is the correct solution yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants