-
Notifications
You must be signed in to change notification settings - Fork 10
/
vite.config.ts
43 lines (40 loc) · 1.2 KB
/
vite.config.ts
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable no-param-reassign */
import { resolve } from 'path';
import { crx } from '@crxjs/vite-plugin';
import react from '@vitejs/plugin-react-swc';
import { defineConfig, Plugin } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
import manifest from './src/manifest';
const viteManifestHackIssue846: Plugin & {
renderCrxManifest: (manifest: any, 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'];
},
};
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
tsconfigPaths(),
viteManifestHackIssue846,
crx({
manifest,
contentScripts: {
injectCss: true,
},
}),
],
resolve: {
alias: {
'@': resolve(__dirname, './src'),
'@utils': resolve(__dirname, './src/utils'),
'@assets': resolve(__dirname, './src/assets'),
},
},
});