blob: 6a2e7d5ecc52d109d621b35c707f8c1e0960feca (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
import { Plugin, defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { crx } from '@crxjs/vite-plugin'
import manifest from './manifest.json'
import path from 'path'
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const viteManifestHackIssue846: Plugin & { renderCrxManifest: (manifest: unknown, bundle: any) => void } = {
// Workaround from https://github.com/crxjs/chrome-extension-tools/issues/846#issuecomment-1861880919.
name: 'manifestHackIssue846',
renderCrxManifest(_manifest, bundle) {
bundle['manifest.json'] = bundle['.vite/manifest.json']
bundle['manifest.json'].fileName = 'manifest.json'
delete bundle['.vite/manifest.json']
},
}
export default defineConfig({
plugins: [
react(),
crx({ manifest }),
viteManifestHackIssue846
],
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
})
|