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 committed Dec 30, 2024
1 parent 284992d commit be7b4f4
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' | 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' | null;
skipManifestValidation: boolean;
printSummary: boolean;
htmlViteConfig?: vite.InlineConfig;
Expand Down

0 comments on commit be7b4f4

Please sign in to comment.