aklinker1 / vite-plugin-web-extension

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

WebExtension Config: disableAutoLaunch has no Impact #90

Closed surtic86 closed 1 year ago

surtic86 commented 1 year ago

Summary

When i set the WebExtension Config disableAutoLaunch: true it will still start a Browser.

webExtension({ disableAutoLaunch: true, manifest: resolve(__dirname, "src/manifest.json"), additionalInputs: ["protected.js", "unprotected.js"], browser: process.env.TARGET || "chrome" }),

Reproduction

I don't think this is necessary the Option should be also checked on this Line https://github.com/aklinker1/vite-plugin-web-extension/blob/e80d47f034e3cd05071ca4da4962b0e93db1c5da/packages/vite-plugin-web-extension/src/plugins/manifest-loader-plugin.ts#L142

As it was don here: https://github.com/aklinker1/vite-plugin-web-extension/blob/e80d47f034e3cd05071ca4da4962b0e93db1c5da/packages/vite-plugin-web-extension/src/plugins/manifest-loader-plugin.ts#L250

I would have make a Pull Request but i have struggled so far to get my Test Project run with my Local Build of vite-plugin-web-extension.

Environment

Docker Image: node:19.7-buster

Thanks for your help.

aklinker1 commented 1 year ago

@surtic86 Good catch. Fixed in v3.0.2

surtic86 commented 1 year ago

thanks

aryzing commented 1 year ago

What does the plugin's auto lauch provide that Vite's open doesn't?

aklinker1 commented 1 year ago

@aryzing they're completely different. Vite's --open just opens a browser to localhost to view your website.

An extension requires you install a dev version of the extension from chrome://extensions. Without doing that, it won't run any content scripts and you won't have access to the web extension APIs.

The auto-launch opens a browser and installs the extension automatically so you don't have to do that yourself.

It might be a little confusing since the plugin still starts up the dev server when running the dev command, but if you access the pages over the URL the server prints out, it won't function as it would inside an installed extension.