Skip to content

Commit

Permalink
fix: use target from webExtConfig if browser option is undefined (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson authored Dec 31, 2024
1 parent 0798a1e commit 6623b0c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ export function createWebExtRunner(

const initialConfig = await loadConfig({ pluginOptions, logger, paths });
const target =
pluginOptions.browser === null || pluginOptions.browser === "firefox"
? null
: "chromium";
pluginOptions.browser === "chrome"
? "chromium"
: pluginOptions.browser === null ||
pluginOptions.browser === "firefox"
? "firefox-desktop"
: initialConfig.target ?? "chromium";

const sourceDir = paths.outDir;
const config = {
Expand Down
4 changes: 2 additions & 2 deletions packages/vite-plugin-web-extension/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export interface UserOptions {
*
* @default "chrome"
*/
browser?: string;
browser?: 'chrome' | 'firefox' | (string & {}) | null;

/**
* Do not validate your manifest to make sure it can be loaded by browsers.
Expand Down Expand Up @@ -119,7 +119,7 @@ export interface ResolvedOptions {
additionalInputs: string[];
disableAutoLaunch: boolean;
watchFilePaths: string[];
browser?: string;
browser?: 'chrome' | 'firefox' | (string & {}) | null;
skipManifestValidation: boolean;
printSummary: boolean;
htmlViteConfig?: vite.InlineConfig;
Expand Down

0 comments on commit 6623b0c

Please sign in to comment.