web-ext icon indicating copy to clipboard operation
web-ext copied to clipboard

DX for Chrome (devtools and browser console)

Open mrksbnch opened this issue 3 years ago • 2 comments

Is this a feature request or a bug?

Not completely sure but most likely a feature request as there are some limitations in Chrome which explain the differences between Firefox and Chrome mentioned below.

What is the current behavior?

When using the command web-ext run --target=chromium --browser-console --devtools --watch-files worker.js ... the DX is not ideal because the browser console and—more importantly—devtools do not open.

So, every time the extension reloads, devtools needs to be opened manually (the previously opened console is disconnected and doesn't work any longer).

What is the expected or desired behavior?

The devtools (and/or browser) console stays open or is opened every time the extension reloads (similar to how it works in Firefox).

Version information

  • Chrome version: 108.0.5359.124
  • Your OS and version: macOS 11.4
  • Node version: 18.11.0
  • web-ext version: 7.4.0

mrksbnch avatar Dec 28 '22 12:12 mrksbnch

I don't know if there's a better way to do this since this issue was opened, but web-ext run can take extra arguments to pass to the binary, and chrome has a flag to open a console on tab load, so the following;

web ext run -t chromium --arg="--auto-open-devtools-for-tabs"

//background/service-worker.js browser.tabs.create({url : extension.url + 'path/to/options.html})

will give you a console mirroring the one you open from the chrome://extensions page

Aixata avatar Dec 17 '24 03:12 Aixata

web ext run -t chromium --arg="--auto-open-devtools-for-tabs"

//background/service-worker.js browser.tabs.create({url : extension.url + 'path/to/options.html})

great thought. thanks for the tip!

nihil2501 avatar Apr 02 '25 05:04 nihil2501