diff --git a/package.json b/package.json index 56de8c14..05ef4c31 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,9 @@ "browserslist": "> 0.5%, last 2 versions, not dead", "scripts": { "dev": "vite dev", + "dev:firefox": "VITE_TARGET=firefox vite build --watch", "build": "vite build", + "build:firefox": "VITE_TARGET=firefox vite build", "package": "rimraf ./dist/*.map && 7z a -tzip extension.zip ./dist/*" }, "targets": { @@ -20,7 +22,7 @@ "author": "", "license": "MIT", "devDependencies": { - "@crxjs/vite-plugin": "beta", + "@crxjs/vite-plugin": "^2.0.0-beta.23", "@vitejs/plugin-react-swc": "^3.6.0", "eslint": "^8.56.0", "parcel": "^2.11.0", diff --git a/vite.config.ts b/vite.config.ts index 868e7513..a04fd623 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -2,18 +2,22 @@ import { defineConfig } from 'vite'; import { join } from 'path'; import manifest from './manifest.json'; +import firefoxManifest from './manifest.firefox.json'; import react from '@vitejs/plugin-react-swc'; //import MillionLint from '@million/lint'; import { crx } from '@crxjs/vite-plugin'; import million from "million/compiler"; +const isFirefox = process.env.VITE_TARGET === 'firefox'; + const plugins = [ react(), million.vite({ auto: true }), //MillionLint.vite(), /* enable for testing and debugging performance */ crx({ - manifest + manifest: isFirefox ? firefoxManifest : manifest, + browser: isFirefox ? 'firefox' : 'chrome' }) ];