aklinker1 / vite-plugin-web-extension

Vite plugin for developing Chrome/Web Extensions
https://vite-plugin-web-extension.aklinker1.io/
MIT License
574 stars 48 forks source link

[Feature request] Define dimensions of autoLaunch window #22

Closed lokimckay closed 2 years ago

lokimckay commented 2 years ago

I'd like to control the size of the Chrome window that automatically launches when running vite build --watch

I only need a small window to test my extension, but it currently launches as a large window - meaning I have to resize it every time I run the command

Is there already a workaround for this?

aklinker1 commented 2 years ago

Chrome supports the --window-size argument when launching from the CLI.

web-ext, the tool used to open the browser and install the extension, supports configuring the CLI arguments passed to the browser start command via the --args flag.

To configure this within the plugin:

webExtension({
  manifest: ...,
  webExtConfig: {
    args: ["--window-size=400x300"],
  },
})

This is untested, web-ext's JS docs aren't great, so I'm assuming --args on the CLI maps to a string array called args in the JS config

I see that the webExtConfig option is not documented in the README, I'll add a section for it.

aklinker1 commented 2 years ago

https://github.com/aklinker1/vite-plugin-web-extension/commit/947b5d987f7c6d722eaf86e783cb73889fb5009e

lokimckay commented 2 years ago

Thanks very much, the below snippet worked in my case (needed to change x to ,)

webExtension({
  manifest: ...,
  webExtConfig: {
    args: ["--window-size=400,300"],
  },
})