wxt: Persist data not working (Windows11, Chrome)

Describe the bug

I’m reading through the new docs and am trying to implement persist-data

I have this in my web-ext.config.ts file (which is in my root):

// web-ext.config.ts
export default defineRunnerConfig({
  chromiumArgs: ["--user-data-dir=./.wxt/chrome-data"],
});

I saved, restarted VSCode and ran pmpm dev. There was no new directory added to .wxt for /chrome-data/

I installed a plugin in the dev launched Chrome, cancelled the dev, restarted everything, and the plugin was not there.

Please see the discussion on https://discord.com/channels/1212416027611365476/1290064175791472670

This problem seems to be exclusive to Windows.

Reproduction

I also tried:

// wxt.config.ts
export default defineConfig({
  runner: { chromiumArgs: ["--user-data-dir=./.wxt/chrome-data"] },
});

Still with no success.

Steps to reproduce

No response

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (16) x64 AMD Ryzen 7 5800H with Radeon Graphics
    Memory: 2.78 GB / 15.33 GB
  Binaries:
    Node: 18.17.1 - C:\Program Files\nodejs\node.EXE
    npm: 10.4.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.11.0 - ~\AppData\Roaming\npm\pnpm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.22621.3527
    Chrome: Version 129.0.6668.71 (Official Build) (64-bit)
  npmPackages:
    wxt: ^0.19.1 => 0.19.10

Used Package Manager

pnpm

Validations

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24 (6 by maintainers)

Most upvoted comments

Thanks for all your hard work!

So… Should I just update the docs to use chromiumProfile instead of --user-data-dir? Does just using a profile keep you logged into sites from previous sessions?

On mac, I know it doesn’t work like that. Since it copies files into a temp dir, logins don’t persist, and you have to log in every time. That’s why --user-data-dir works, it doesn’t move or copy the files, so you stay logged in.

Do we also need to recommend using keepProfileChanges alongside chromiumProfile?

export default defineRunnerConfig({
    chromiumProfile: `${resolve('.wxt/chrome-data')}`,
    keepProfileChanges: true,
});

If so, I think it makes sense to create option that automatically applies the required config based on the current operating system.

export default defineRunnerConfig({
    preset: "persist"
    // Windows:
    // chromiumProfile: `${resolve('.wxt/chrome-data')}`,
    // keepProfileChanges: true,
    // Mac/Linux:
    // chromiumArgs: ["--user-data-dir=./.wxt/chrome-data"],
});

I copied the chrome-data the commandline created in the downloads folder to the .wxt folder in my project. Still didn’t use that.

Wait, hold on, so it did create a chrome-data folder at some point?