Skip to content

Opera and Yandex are not recognized as separate browsers, import.meta.env.BROWSER returns "chrome" #1903

@romant094

Description

@romant094

Describe the bug

When building an extension with WXT for Opera or Yandex Browser, import.meta.env identifies the browser as chrome. Because of this, it’s impossible to add Opera-specific or Yandex-specific logic.

Example for Opera

BROWSER: "chrome"
CHROME: true
OPERA: false

Example for Yandex

BROWSER: "chrome"
CHROME: true

Expected result (Opera)

BROWSER: "opera"
CHROME: false
OPERA: true

Expected result (Yandex)

BROWSER: "yandex"
CHROME: false
YANDEX: true

Notes
Opera and Yandex Browser, while Chromium-based, diverge in supported APIs and UX.
For example, Opera has its own sidebar implementation, while Yandex Browser does not support chrome.sidePanel.
It would be very helpful to expose Yandex: boolean in import.meta.env (similar to CHROME, EDGE, etc.), and also recognize Opera properly.

Reproduction

chrome-mv3.zip

Steps to reproduce

1. Build the extension using WXT (wxt build) and load it in Opera or Yandex Browser.
2. Log import.meta.env to the console inside the extension code.
3. Check the environment variables.
4. Load archive content in dev mode

System Info

WXT: 0.20.6
Browsers: Opera (Chromium-based), Yandex Browser (Chromium-based)
Command: wxt build

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending-triageSomeone (usually a maintainer) needs to look into this to see if it's a bug

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions