From c8ff703cf21feb7fc11afe4a3b1a4b3b26872a0d Mon Sep 17 00:00:00 2001 From: Lahgolz Date: Mon, 16 Dec 2024 11:39:04 +0100 Subject: [PATCH] fix: remove myPlugin from firefox vite config --- vite.config.firefox.ts | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/vite.config.firefox.ts b/vite.config.firefox.ts index 4796a7a..43855aa 100644 --- a/vite.config.firefox.ts +++ b/vite.config.firefox.ts @@ -1,46 +1,10 @@ -import { defineConfig, Plugin } from 'vite'; +import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import { crx } from '@crxjs/vite-plugin'; import zipPack from 'vite-plugin-zip-pack'; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-expect-error -import fs from 'node:fs'; -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-expect-error -import path from 'node:path'; import manifest from './manifest.json'; -function myPlugin(): Plugin { - function updateManifest() { - const absolutePath = path.resolve('./dist-firefox/manifest.json'); - - const content = fs.readFileSync(absolutePath); - const test = JSON.parse(content); - test.web_accessible_resources = test.web_accessible_resources.map((i) => ({ - ...i, - use_dynamic_url: false, - })); - fs.writeFile(absolutePath, JSON.stringify(test, null, 2), (err) => { - if (err) { - console.error(err); - } else { - console.log('manifest.json updated'); - } - }); - } - - return { - name: 'my-plugin', - generateBundle(options, bundle) { - console.log(bundle); - }, - writeBundle() { - updateManifest(); - }, - }; -} - // https://vitejs.dev/config/ export default defineConfig({ build: { @@ -50,7 +14,6 @@ export default defineConfig({ plugins: [ react(), crx({ manifest: manifest as any, browser: 'firefox' }), - myPlugin(), zipPack({ inDir: 'dist-firefox', outFileName: 'firefox.zip' }), ], });