fix: separate firefox dev and build scripts

This commit is contained in:
sethburkart123
2024-06-16 08:14:51 +10:00
parent cbbd1c913c
commit a1582b0e74
2 changed files with 8 additions and 2 deletions
+3 -1
View File
@@ -6,7 +6,9 @@
"browserslist": "> 0.5%, last 2 versions, not dead", "browserslist": "> 0.5%, last 2 versions, not dead",
"scripts": { "scripts": {
"dev": "vite dev", "dev": "vite dev",
"dev:firefox": "VITE_TARGET=firefox vite build --watch",
"build": "vite build", "build": "vite build",
"build:firefox": "VITE_TARGET=firefox vite build",
"package": "rimraf ./dist/*.map && 7z a -tzip extension.zip ./dist/*" "package": "rimraf ./dist/*.map && 7z a -tzip extension.zip ./dist/*"
}, },
"targets": { "targets": {
@@ -20,7 +22,7 @@
"author": "", "author": "",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@crxjs/vite-plugin": "beta", "@crxjs/vite-plugin": "^2.0.0-beta.23",
"@vitejs/plugin-react-swc": "^3.6.0", "@vitejs/plugin-react-swc": "^3.6.0",
"eslint": "^8.56.0", "eslint": "^8.56.0",
"parcel": "^2.11.0", "parcel": "^2.11.0",
+5 -1
View File
@@ -2,18 +2,22 @@ import { defineConfig } from 'vite';
import { join } from 'path'; import { join } from 'path';
import manifest from './manifest.json'; import manifest from './manifest.json';
import firefoxManifest from './manifest.firefox.json';
import react from '@vitejs/plugin-react-swc'; import react from '@vitejs/plugin-react-swc';
//import MillionLint from '@million/lint'; //import MillionLint from '@million/lint';
import { crx } from '@crxjs/vite-plugin'; import { crx } from '@crxjs/vite-plugin';
import million from "million/compiler"; import million from "million/compiler";
const isFirefox = process.env.VITE_TARGET === 'firefox';
const plugins = [ const plugins = [
react(), react(),
million.vite({ auto: true }), million.vite({ auto: true }),
//MillionLint.vite(), /* enable for testing and debugging performance */ //MillionLint.vite(), /* enable for testing and debugging performance */
crx({ crx({
manifest manifest: isFirefox ? firefoxManifest : manifest,
browser: isFirefox ? 'firefox' : 'chrome'
}) })
]; ];