Skip to content

Enable extension developer setting in Chrome automatically in dev mode #137

Description

@aklinker1

Feature Request

When running wxt to develop and extension, it's really annoying to have to enable developer mode every time to inspect the different JS contexts of your extension. We should be able to enable it automatically via CLI flags? I assume the switch is just a preference that we can control via CLI flags.

Is your feature request related to a bug?

#135

What are the alternatives?

N/A

Additional context

Also a problem with Edge, so we should add the setting to edge and other chromium browsers as well. Hopefully they're all the same internal preference...

Activity

  1. aklinker1 commented on Sep 30, 2023

    @aklinker1
    MemberAuthor
  2. aklinker1 commented on Sep 30, 2023

    @aklinker1
    MemberAuthor

    I kept looking into this, and it is possible, but it's blocked by GoogleChrome/chrome-launcher#323.

    web-ext allows passing a custom chromeLaunch option, which I can use to apply custom prefs.

    runner = await webExt.default.cmd.run(finalConfig, options);

    https://github.com/mozilla/web-ext/blob/a83f4c55a8fe0d2323d2d17ffbfa1754ec32f49c/src/extension-runners/chromium.js#L43

    import { launch } from 'chrome-launcher';
    
    await webExt.default.cmd.run({
      ...finalConfig,
      chromiumLaunch: (options) => launch({ ...options, prefs: { ... } }),
    }, options); 
  3. self-assigned this
    on Sep 30, 2023
  4. added this to the DX Improvements milestone on Oct 2, 2023
  5. aklinker1 commented on Oct 3, 2023

    @aklinker1
    MemberAuthor

    Can't pass the custom chromiumLaunch into the JS API... Need to wait for web-ext to add support, or add the feature to my fork. I'd rather contribute this to web-ext though.

    mozilla/web-ext#2899

  6. added
    upstream
    on Dec 26, 2023
  7. aklinker1 commented on Nov 22, 2024

    @aklinker1
    MemberAuthor

    This appears to be broken again

  8. aklinker1 commented on Nov 22, 2024

    @aklinker1
    MemberAuthor

    Need to figure out what the new preference is. Old preference:

    https://github.com/wxt-dev/web-ext-run/blob/a5d1e24b528911eb3b7d93439c45cc30094682be/src/extension-runners/chromium.js#L34-L36

    Here's where we can set the new one if we find it:

    const DEFAULT_CHROMIUM_PREFS = {
    devtools: {
    synced_preferences_sync_disabled: {
    // Remove content scripts from sourcemap debugger ignore list so stack traces
    // and log locations show up properly, see:
    // https://github.com/wxt-dev/wxt/issues/236#issuecomment-1915364520
    skipContentScripts: false,
    // Was renamed at some point, see:
    // https://github.com/wxt-dev/wxt/issues/912#issuecomment-2284288171
    'skip-content-scripts': false,
    },
    },
    };

  9. hzuo commented on Jan 9, 2025

    @hzuo

    @aklinker1 bumping into this issue repeatedly too! Did you end up figuring out what the new preference is? I'm ok with manually setting it via chromiumPrefs.

  10. aklinker1 commented on Jan 9, 2025

    @aklinker1
    MemberAuthor

    Nope, when I looked at the preferences file there was no flag that appeared to change when toggling the setting.

  11. gb-jos commented on May 22, 2025

    @gb-jos

    @hzuo @aklinker1 bumped into this issue trying to figure out where the pref is, seemingly it is in "Secure Preferences" file now instead of "Preferences"

  12. PatrykKuniczak commented on Aug 15, 2025

    @PatrykKuniczak
    Collaborator

    That's really annoying, we need to fix it :)

  13. aklinker1 commented on Sep 3, 2025

    @aklinker1
    MemberAuthor

    bumped into this issue trying to figure out where the pref is, seemingly it is in "Secure Preferences" file now instead of "Preferences"

    Lovely. I won't get to this for a while, it's a change required on web-ext. Someone else is free to open a PR. But this has changed some much I closed my old PR for regular preferences.

    You can refer to this PR for reference: mozilla/web-ext#2912

  14. garretwilson commented on Sep 16, 2025

    @garretwilson

    I had been seeing issues when WXT tried to live-update the service worker: the extension would just disappear! I realized that it would become disabled because developer mode wasn't enabled. (I'm using Windows.)

    After enabling browser profile persistence, each time I would use npm run dev I wouldn't even see the changes in the browser! I finally realized that this was the same issue: Chrome wasn't reloading the extension because it had gotten "stuck" because developer mode wasn't turned on, and this "stuck" state was now persisted.

    Once I turned on developer mode manually, using browser profile persistence seems to keep it on and everything is updating now.

    In summary it would be nice if WXT would turn on developer mode automatically, but using browser profile persistence is a workaround (still requiring manually to select developer mode once). Something about this might be helpful in the docs.

  15. PatrykKuniczak commented on Feb 9, 2026

    @PatrykKuniczak
    Collaborator

    @aklinker1 We are able to solve this issue in some way?
    Maybe you are able to finish your work on PR in web-ext, now it has more sense to make it one more time, instead of rebase on this closed one.

    But anyway are you even consider to do it, or you have other plan to give possibility to our users to enable this option?

  16. aklinker1 commented on Feb 9, 2026

    @aklinker1
    MemberAuthor

    I'm not going to continue this work. Chrome has changed where the value is stored multiple times now, breaking WXT each time. I'm not gonna fight against that 🤷 Gotta pick your battles.

    If someone else wants to maintain this feature, feel free to continue where I left off on my web-ext PR.

  17. PatrykKuniczak commented on May 23, 2026

    @PatrykKuniczak
    Collaborator

    @aklinker1 It's released already:
    https://github.com/mozilla/web-ext/releases/tag/10.2.0

    But i can't bump it, because we're using https://github.com/wxt-dev/web-ext-run
    But you have a plan to migrate from it, to web-ext directly, when you'll do this, this feature will be implemented.

  18. aklinker1 commented on Jun 28, 2026

    @aklinker1
    MemberAuthor

    Gonna do a major release soon, #2447, will be fixed in that. We're adding web-ext as a peer, dropping my fork web-ext-run.

  19. PatrykKuniczak commented on Jun 29, 2026

    @PatrykKuniczak
    Collaborator

    @aklinker1 Good to hear.
    I've tried my best and use a part of your work, to make it possible ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

upstream

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions