Skip to content
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

--user-data-dir not work in Windows10 , same to #586 #1132

Closed
5 tasks done
slow-groovin opened this issue Nov 1, 2024 · 4 comments
Closed
5 tasks done

--user-data-dir not work in Windows10 , same to #586 #1132

slow-groovin opened this issue Nov 1, 2024 · 4 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@slow-groovin
Copy link

slow-groovin commented Nov 1, 2024

Describe the bug

When setting --user-data-dir to persist config, it didn't work,
the target dir is empty after start and exit dev.
It's same to #586, two --user-data-dir appears twice in chrome://version/ Command Line, and the first have effect

image

Reproduction

same to #586

export default defineRunnerConfig({
	// On Windows, the path must be absolute
	chromiumArgs: [
		`--user-data-dir=D:\\slow-groovin\\Documents\\wxt-learn\\.wxt\\chrome-data`,
		`--lang=en`
	],
});

Steps to reproduce

No response

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 AMD Ryzen 7 
    Memory: 12.99 GB / 30.69 GB
  Binaries:
    Node: 22.10.0 - D:\Program Files\nodejs\node.EXE
    npm: 10.9.0 - D:\Program Files\nodejs\npm.CMD
    pnpm: 9.12.3 - D:\Program Files\nodejs\pnpm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.19041.4355

Used Package Manager

pnpm

Validations

@slow-groovin slow-groovin added the pending-triage Someone (usually a maintainer) needs to look into this to see if it's a bug label Nov 1, 2024
@only-issues
Copy link

+1

@Dollyn
Copy link

Dollyn commented Nov 12, 2024

after dig into the code, find out that it did work, but not as sample as the doc said.

without the keepProfileChanges: true flag, web-ext-run will copy the dir you spicified with --user-data-dir to a temp dir and use that temp dir every time on start.

so if you want to use a seperate dir as chrome profile, and prevent settings lost every time on start,
the following config will work.

export default defineRunnerConfig({
  keepProfileChanges: true,
  chromiumProfile: "C:\\Users\\xxx\\yyy\\chrome-data",
});

BTW,
that leed to another issue, some chrome preferences will be reset every time, because of chrome-launcher issue/feature:
GoogleChrome/chrome-launcher#335.
they use a sample/fake merge method with existing prefs

this.fs.writeFileSync(preferenceFile, JSON.stringify({...content, ...this.prefs}), 'utf-8');

and unfortunately, web-ext-run hard coded a default pref:

const DEFAULT_PREFS = {
  'extensions.ui.developer_mode': true
};

so chrome prefs start with 'extensions.' will lost.
if you want to save some related prefs, for example you want ur extensions icon pinned, you have to set that in runner setings:

export default defineRunnerConfig({
  // ... other configs
  chromiumPref: {
    extensions: {
      ui: { developer_mode: true, },
      pinned_extensions: ["ur-extension-id"]
    }
  }
});

@aklinker1 aklinker1 added bug Something isn't working and removed pending-triage Someone (usually a maintainer) needs to look into this to see if it's a bug labels Nov 14, 2024
@slow-groovin
Copy link
Author

@Dollyn Thanks! setting like this meets my requirements.

Additionally, the configurations in the Chrome Pref documentation includes few.
The best way is copy the real valid configurations in the actual Chrome Preference file (the Preference file is located at C:\Users\AppData\Local\Chromium\User Data\Default\Preferences).

Below is my configuration, which is used to modify the DevTools location and language. Note that the value of the configuration must include the escaped colon (exactly as it appears in the Preferences file).

chromiumPref: {
		extensions: {
			ui: {developer_mode: true,},
			pinned_extensions: [""]
		},
		devtools:{
			preferences:{
				// "currentDockState": "bottom", //not work
				"currentDockState": "\"bottom\"",

			},
			"synced_preferences_sync_disabled": {
				"language": "\"zh\"",
			}
		},
		download: {default_directory: resolve('.wxt/download'),},

	}

@aklinker1 aklinker1 added the duplicate This issue or pull request already exists label Nov 18, 2024
@aklinker1
Copy link
Collaborator

Gonna close this as a duplicate of #1023, seems to be the same problem.

@aklinker1 aklinker1 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants