Skip to content

Commit 6623b0c

Browse files
authored
fix: use target from webExtConfig if browser option is undefined (#232)
1 parent 0798a1e commit 6623b0c

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

Diff for: packages/vite-plugin-web-extension/src/extension-runner/web-ext-runner.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@ export function createWebExtRunner(
2727

2828
const initialConfig = await loadConfig({ pluginOptions, logger, paths });
2929
const target =
30-
pluginOptions.browser === null || pluginOptions.browser === "firefox"
31-
? null
32-
: "chromium";
30+
pluginOptions.browser === "chrome"
31+
? "chromium"
32+
: pluginOptions.browser === null ||
33+
pluginOptions.browser === "firefox"
34+
? "firefox-desktop"
35+
: initialConfig.target ?? "chromium";
3336

3437
const sourceDir = paths.outDir;
3538
const config = {

Diff for: packages/vite-plugin-web-extension/src/options.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export interface UserOptions {
6262
*
6363
* @default "chrome"
6464
*/
65-
browser?: string;
65+
browser?: 'chrome' | 'firefox' | (string & {}) | null;
6666

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

0 commit comments

Comments
 (0)