Open paolostyle opened 1 week ago
What version of web-ext-run
is installed?
FWIW I found out that WXT exists and migrated to that, though in any case this should probably be fixed.
Yeah, this should probably be moved to web-ext-run
, but I don't have a windows machine so someone else will have to look into it :(
I spent some time debugging and it seems like it's not an issue with web-ext-run
or even web-ext
but rather with chrome-launcher
. See this issue: https://github.com/GoogleChrome/chrome-launcher/issues/334. The workaround described there does solve the issue, so I can create a PR to web-ext-run
if you'd be interested. This change makes a bunch of tests fail though so I'd have to look into it, or optionally we could just add this flag only when in WSL using something like is-wsl
. On the other hand WXT makes me install the extension manually (perhaps we could try to solve it, at least partially?), so this would only be useful for this Vite plugin.
Overall ideally this issue would be fixed in chrome-launcher
but I feel like this is going to be a huge rabbit hole. I won't even attempt to fix it upstream in web-ext
because I don't think it supports WSL very well anyway and they probably just want to have it fixed in chrome-launcher
.
Let me know what do you think about this.
As for the GH issue itself - agreed, if you can move this issue there (I'm not sure if it's possible but I think it is) that would be great.
On the other hand WXT makes me install the extension manually (perhaps we could try to solve it, at least partially?)
Oh yeah, after writing this plugin and seeing how many people were running into problems with WSL, I disabled auto-opening the browser in WXT. My recommendation would be to not use WSL with the plugin, use CMD/Powershell instead. There are more issues than just this one with WSL support, that's why I recommend not using it.
And I agree that this should be fixed in chrome-launcher
.
Summary
It is probably caused by some extenral dependency that creates the temp files, but I'm reporting it here as I don't know what exactly is causing it.
When I run
vite
(orpnpm start
in the repro repo below), generally everything works fine, but a new folder is created in the main project directory, named more or less\\wsl.localhost\Ubuntu-20.04\tmp\tmp-web-ext--26812-4hebg9Fx5Dr7
(notice the backslashes). Interestingly, a folder with exactly the same name is created in/tmp
directory in the Linux file system.If I remove it, nothing really breaks, the extension and hot reloading is working fine in the browser, but when I'm making changes it gets recreated. This is super annoying as this folder is not removed automatically when I close Vite and another one gets created after the restart. For now I gitignored it but it's really annoying and it shouldn't happen.
I'm quite certain this only happens on WSL so if you don't have it set up it's going to be difficult to reproduce. But I'm obviously willing to help out with debugging, just need some pointers on what might be causing it.
Reproduction
https://github.com/paolostyle/vite-web-ext-repro
Focus mostly on
vite.config.ts
, the rest I think is mostly irrelevant. Chrome runs from WSL so that might also potentially be the cause (?)Environment
Likely critically important information that is not visible below - I'm running Ubuntu under WSL on Windows 11.