Use vite --mode for target selection

This commit is contained in:
2026-09-12 15:00:07 -07:00
parent f7372635fe
commit 7c024baac0
2 changed files with 6 additions and 7 deletions

View File

@@ -4,10 +4,10 @@
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "TARGET=firefox vite", "dev": "vite --mode chrome",
"build:web": "TARGET=web vite build", "build:web": "vite build --mode web",
"build:firefox": "TARGET=firefox vite build", "build:firefox": "vite build --mode firefox",
"build:chrome": "TARGET=chrome vite build", "build:chrome": "vite build --mode chrome",
"build": "bun run build:firefox && bun run build:chrome" "build": "bun run build:firefox && bun run build:chrome"
}, },
"dependencies": { "dependencies": {

View File

@@ -1,9 +1,8 @@
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
import fs from 'node:fs'; import fs from 'node:fs';
const target = process.env.TARGET || 'firefox'; export default defineConfig(async ({ mode }) => {
const target = process.env.TARGET || (['chrome', 'firefox', 'web'].includes(mode) ? mode : 'chrome');
export default defineConfig(async () => {
const plugins = []; const plugins = [];
if (target !== 'web') { if (target !== 'web') {